Sunday, September 22, 2013

[Rails] errors.on equilvalent on Rails 4

Hello!

I'm starting with RoR today, but I buy a RoR 3.2 book, and my installation on Ubuntu is Rails 4 and Ruby 2.0.

 

Anyway, in book I have this code:

article.errors.on(:title)

But, not works in Rails 4.

2.0.0-p247 :074 > article.errors.on(:title)  NoMethodError: undefined method `on' for #<ActiveModel::Errors:0x0000000427e238>  	from (irb):74  	from /home/patrick/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands/console.rb:90:in `start'  	from /home/patrick/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in `start'  	from /home/patrick/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:64:in `<top (required)>'  	from bin/rails:4:in `require'  	from bin/rails:4:in `<main>'  2.0.0-p247 :075 >   

What is equivalent

on( )

method?

 

Thanks!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/cf41b4a1-b606-49d7-9bd3-5f48009a0e89%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate