这种方法在我的应用程序中不起作用并且没有给出任何错误,我正在使用设计并观看了设计剧集 RailsCast ,我在观看时写了这个但没有发生任何事情,能做什么???我已经搜索但找不到它有什么必要的步骤?
<% if user_signed_in? %><%= current_user.email %><% end %>
我正在使用 RubyMine ,user_signed_in
并current_user
标记为无法找到。
从Rails Console --sandbox
Loading development environment in sandbox (Rails 3.2.12)
Any modifications you make will be rolled back on exit
irb(main):001:0> user_signed_in?
NoMethodError: undefined method `user_signed_in?' for main:Object
from (irb):1
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands/console.rb:47:in `start'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands/console.rb:8:in `start'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'