ruby on rails 4 - Paper Clip is not saving thumbnails -


i have following code in model:

   has_attached_file :avatar,             path: ':class/:attachment/:id/:style/:basename.:extension',             :styles=> { :original => "500x500",                       :small => "200x200"                    }, default_url: "icons/user.png" 

i have installed imagemagick.

which convert /usr/bin/convert 

in development.rb

 paperclip.options[:command_path] = %w(/usr/local/bin/ /usr/bin/) 

i have tried following:

   paperclip.options[:command_path] = "/usr/bin/" 

but when try upload picture saves original file. message log is:

[paperclip] saving user_profiles/avatars/53/original/2015-06-08-153213.jpg 

what i'm missing?

in model can add below code. don't need worry size specified in code, can change size need.

  has_attached_file :avatar, styles: { medium: '200x200>', thumb: '80x80>' }, default_url: "/icons/user.png"   validates_attachment_content_type :avatar, content_type: /\aimage\/.*\z/ 

in case convert path /usr/bin/convert. default path. don't need specify in development.rb file. please remove , give try.

also make sure have permitted params in controller.

sample code

# in controller file private def user_params   params.require(:user).permit(:email, :avatar) end 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -