Module: ActiveResourceFixes31
- Defined in:
- lib/remotable/active_resource_fixes.rb
Instance Method Summary collapse
-
#load_attributes_from_response(response) ⇒ Object
! in this method, don’t check the Content-Type header: rack doesn’t always return it.
-
#respond_to?(method_symbol, include_private = false) ⇒ Boolean
ActiveResource hacks method_missing without hacking respond_to? In fact, it responds to any method that ends in an equals sign.
Instance Method Details
#load_attributes_from_response(response) ⇒ Object
! in this method, don’t check the Content-Type header: rack doesn’t always return it
81 82 83 84 85 86 |
# File 'lib/remotable/active_resource_fixes.rb', line 81 def load_attributes_from_response(response) if !response.body.nil? && response.body.strip.size > 0 load(self.class.format.decode(response.body), true) @persisted = true end end |
#respond_to?(method_symbol, include_private = false) ⇒ Boolean
ActiveResource hacks method_missing without hacking respond_to? In fact, it responds to any method that ends in an equals sign. It also responds to any method that matches an attribute name.
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/remotable/active_resource_fixes.rb', line 69 def respond_to?(method_symbol, include_private=false) method_name = method_symbol.to_s if method_name =~ /\w+=/ true elsif attributes.include?(method_name) true else super(method_symbol, include_private) end end |