method

on

Importance_2
v1.0.0 - Show latest stable - 1 note - Class: ActiveRecord::Errors
on(attribute) public
  • Returns nil, if no errors are associated with the specified attribute.
  • Returns the error message, if one error is associated with the specified attribute.
  • Returns an array of error messages, if more than one error is associated with the specified attribute.
Show source
Register or log in to add new notes.
August 8, 2014 - (v3.0.0 - v4.0.2)
0 thanks

Deprecated in favour of []

In Rails 3+

company.errors[:name]

In Rails 2.3 and below:

company.errors.on(:name)