I am trying to write a method in my "team" model but current_user is showing this error
undefined local variable or method `current_user' for #
def set_default_url
if current_user.id == self.user_id
"/assets/default_black_:style_logo.jpg"
else
"/assets/default_:style_logo.jpg"
end
end
The method current_user is working fine for other models and controllers . I am calling this method like this .
has_attached_file :logo, :styles => {
:medium => "200x200#",
:thumb => "100x100#",
:small => "50x50#"
},
:default_url => :set_default_url
I am using rails 3.2 , ruby 1.9.3 and devise 3.1 . It seems to be simple task but I don't understand where the fault lies . I will be really thankful if someone helps me out here .
Aucun commentaire:
Enregistrer un commentaire