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/rails: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
falsesince you have no variable namedpersonhence no method calledvalid?can be called on it. This is normal irb behaviour telling you you’ve done something wrong.