Flowdock
method

each_full

Importance_1
v2.3.8 - Show latest stable - 0 notes - Class: ActiveResource::Errors
each_full() public

Yields each full error message added. So Person.errors.add("first_name", "can’t be empty") will be returned through iteration as "First name can’t be empty".

Examples

  my_person = Person.new(params[:person])

  my_person.errors.add('login', 'can not be empty') if my_person.login == ''
  my_person.errors.add('password', 'can not be empty') if my_person.password == ''
  messages = ''
  my_person.errors.each_full {|msg| messages += msg + "<br/>"}
  messages
  # => "Login can not be empty<br />Password can not be empty<br />"
Show source
Register or log in to add new notes.