0
我想用户轨控制台,但我每次键入命令时,我得到轨控制台错误
NameError: undefined local variable or method `user' for main:Object
from (irb):3
from /Users/Home/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/commands/console.rb:44:in `start'
from /Users/Home/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/commands/console.rb:8:in `start'
from /Users/Home/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
我不能查看我的任何车型,甚至执行基本的东西
任何人都可以请给出任何建议?
非常感谢 答
加载开发环境(滑轨3.0.9) 红宝石1.9.2-P180:001> PP用户 NameError:从(IRB)对象 \t:1 \t未定义局部变量或方法 '用户' 用于主from /Users/Home/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/commands/console.rb:44:in'start' \t from/Users /Home/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/commands/console.rb:8:in'start' \t from/Users/Home/.rvm/gems/ruby-1.9.2-p180 @ rails3/gems/railties-3.0.9/lib/rails/commands.rb:23:在'' \t from script/rails:6 :在'require' \t from脚本/导轨:6:'' ruby-1.9.2-p180:002>' –
Ansd
您必须将变量用户设置为某个值。用户= User.first –
很多很多谢谢..我不知道我是如何做到这个愚蠢的错误。再次感谢。 – Ansd