ruby - Paperclip Rails error when trying to refresh -


my user model:

class user < activerecord::base   has_attached_file :avatar, :styles => { :profile => "200x200>", :collab => "300x200>", :msg => "50x50>" }, :default_url => "missing.png"   validates_attachment_content_type :avatar, :content_type => /\aimage\/.*\z/   ... 

i have added :msg , :profile styles , i'm trying refresh them show in views.

i've tried running:

rake paperclip:refresh class=user 

and error:

rake aborted! argumenterror: wrong number of arguments (0 1) /home/jrile/rails/cs480/app/models/user.rb:44:in `hash' /home/jrile/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment_registry.rb:42:in `names_for' /home/jrile/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment_registry.rb:16:in `names_for' /home/jrile/rails/cs480/lib/tasks/paperclip.rake:15:in `obtain_attachments' 

here's line 44 of user.rb (not sure why has paperclip)

def user.hash(token)     digest::sha1.hexdigest(token.to_s) end 

i trying add avatar following railstutorial.org.

edit: also, in views i'm trying display avatar, it's displaying ":msg" if i'm trying display 1 of other two. i.e.,

<%= image_tag user.avatar.url(:profile) %> 

is showing 50x50 avatar.

for first issue, so question

you shouldn't override ruby core methods object#hash made specific reasons , changing behavior cause unexpected results , apparently later on tutorial change to:

def user.digest(token)   digest::sha1.hexdigest(token.to_s) end 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -