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