Devise error - Reg

24 views
Skip to first unread message

Arun Kumar

unread,
Jan 14, 2015, 7:01:45 AM1/14/15
to rubyonra...@googlegroups.com
Hello.I have been following one month rails tutorial in which they developed a clone of Pinterest.In the tutorials,pins were created using paperclip gem.I tried to add profile avatars using paperclip gem.So i ran a migration to add an avatar to user table.I wanted the user to upload a picture on signup.I used Devise gem for authentication.So i modifed my views((signup.html.erb) and (edit.html.erb)).
I added parameter sanitizers in my application_controller to modify devise controller settings.But the problem is iam getting an UnknownAtrributeError:Avatar


And in the tutorial jquery-masonry gem was used to make it look a more like pinterest.It worked at first.But now itsn't working.

I have attached the error screenshots and this is the link of my project on github:

Please reply me.I am stuck on this error for a long time.

error.png
signup.png

Vivek Sampara

unread,
Jan 14, 2015, 7:36:16 AM1/14/15
to rubyonra...@googlegroups.com
Arun, 

Did you add the field for avatar for user model ? you need to do 2 steps. 

2. run rake db:migrate 

Restart server and check again . 

Cheers
Vivek 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAOkoSsen8C_cojqYHENp7%2BXHjxXJp7RVYp3YcCk1XoMHOPfEQg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Loureiro

unread,
Jan 19, 2015, 9:04:17 PM1/19/15
to rubyonra...@googlegroups.com
Hi Arun,

did you permitted the "avatar" field in the strong parameters?

If you are using Devise, edit your application_controller.rb to something like this:

class ApplicationController < ActionController::Base
  before_filter
:configure_permitted_parameters, if: :devise_controller?

 
protected

 
def configure_permitted_parameters
    devise_parameter_sanitizer
.for(:sign_up) << :avatar
 
end
end

--
Daniel Loureiro
Reply all
Reply to author
Forward
0 new messages