开发者

NoMethodError after loggin in in Ruby on Rails networking website

I'm trying to make an example of a small networking site, and when I log in a user, it should redirect and show his profile, but I get the following error:

NoMethodError in User#index

Show开发者_运维知识库ing app/views/user/index.html.erb where line #5 raised:

undefined method `screen_name' for nil:NilClass Extracted source (around line #5):

2: Your basic information 3: 4:

    5:
  • Screen name: <%= @user.screen_name %>
  • 6:
  • Email: <%= @user.email %>
  • 7:
  • Password: **********
  • 8:

Thanks a lot in advance!


Your @user object is "nil". You need to make sure that you set @user, e.g. via a "before_filter".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜