Have i screwed up my rails console? I get verbose errors?
When i type something like person.valid?
in my rails console, instead of returning 'false' i get the following output:
NameError: undefined local variable or method `person' for main:Object
from (irb):7
from /Users/xxx/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands/console.rb:44:in `start'
from /Users/xxx/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands/console.rb:8:in `start'
from /Users/xxx/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands.rb:23:in `<top (required)>'
from script/rai开发者_如何学运维ls:6:in `require'
from script/rails:6:in `<main>'
I'm not sure if this is a feature i've accidentally enabled or if i've got something wrong with my install. If all of this output is not needed, how can i get rid of it?
Cheers.
You don't get false
since you have no variable named person
hence no method called valid?
can be called on it. This is normal irb behaviour telling you you've done something wrong.
精彩评论