Module: ActiveResourceFixes
- Defined in:
- lib/remotable/active_resource_fixes.rb
Instance Method Summary collapse
-
#attribute(method) ⇒ Object
! ActiveModel::AttributeMethods assumes that :attribute is the target for attribute lookup.
-
#destroy ⇒ Object
ActiveResource::Validations overrides ActiveResource::Base#save to rescue from ActiveResource::ResourceInvalid and record the resource’s errors.
Instance Method Details
#attribute(method) ⇒ Object
! ActiveModel::AttributeMethods assumes that :attribute is the target for attribute lookup. ActiveResource doesn’t define that method.
7 8 9 |
# File 'lib/remotable/active_resource_fixes.rb', line 7 def attribute(method) attributes[method] end |
#destroy ⇒ Object
ActiveResource::Validations overrides ActiveResource::Base#save to rescue from ActiveResource::ResourceInvalid and record the resource’s errors. Do the same for ‘destroy`.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/remotable/active_resource_fixes.rb', line 14 def destroy super rescue ActiveResource::ResourceInvalid => error # cache the remote errors because every call to <tt>valid?</tt> clears # all errors. We must keep a copy to add these back after local # validations. @remote_errors = error load_remote_errors(@remote_errors, true) false end |