I am trying to make an app with Rails 4 & devise.
I am trying to follow this tutorial:
http://sourcey.com/rails-4-omniauth-using-devise-with-twitter-facebook-and-linkedin/
When I complete the steps, and run the server, I get this error
NoMethodError (undefined method `update' for nil:NilClass):
2015-12-14T20:37:03.180526+00:00 app[web.1]: app/controllers/users_controller.rb:43:in `finish_signup'
2015-12-14T20:37:03.180540+00:00 app[web.1]:
the finish sign up method is:
def finish_signup
# authorize! :update, @user
if request.patch? && params[:user] #&& params[:user][:email]
if @user.update(user_params)
@user.skip_reconfirmation!
sign_in(@user, :bypass => true)
redirect_to @user, notice: 'Your profile was successfully updated.'
else
@show_errors = true
end
end
end
The specific line identified as the problem is:
if @user.update(user_params)
Does anyone see what's going wrong? I don't know how to read the error to understand what it's complaining about. Can anyone see the problem?
before_action :set_filter, like in example? You should, otherwise there's no@userinstance variable set. - Marek Lipka