--- !ruby/object:RI::ClassDescription 
attributes: []

class_methods: []

comment: 
- !ruby/struct:SM::Flow::P 
  body: Module to support validation and errors with Active Resource objects. The module overrides Base#save to rescue ActiveResource::ResourceInvalid exceptions and parse the errors returned in the web service response. The module also adds an <tt>errors</tt> collection that mimics the interface of the errors provided by ActiveRecord::Errors.
- !ruby/struct:SM::Flow::H 
  level: 4
  text: Example
- !ruby/struct:SM::Flow::P 
  body: "Consider a Person resource on the server requiring both a <tt>first_name</tt> and a <tt>last_name</tt> with a <tt>validates_presence_of :first_name, :last_name</tt> declaration in the model:"
- !ruby/struct:SM::Flow::VERB 
  body: "  person = Person.new(:first_name =&gt; &quot;Jim&quot;, :last_name =&gt; &quot;&quot;)\n  person.save                   # =&gt; false (server returns an HTTP 422 status code and errors)\n  person.valid?                 # =&gt; false\n  person.errors.empty?          # =&gt; false\n  person.errors.count           # =&gt; 1\n  person.errors.full_messages   # =&gt; [&quot;Last name can't be empty&quot;]\n  person.errors.on(:last_name)  # =&gt; &quot;can't be empty&quot;\n  person.last_name = &quot;Halpert&quot;\n  person.save                   # =&gt; true (and person is now saved to the remote service)\n"
constants: []

full_name: ActiveResource::Validations
includes: []

instance_methods: 
- !ruby/object:RI::MethodSummary 
  name: errors
- !ruby/object:RI::MethodSummary 
  name: save_with_validation
- !ruby/object:RI::MethodSummary 
  name: valid?
name: Validations
superclass: 
