Module: ActiveResourceFixes30
- 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
55 56 57 58 59 |
# File 'lib/remotable/active_resource_fixes.rb', line 55 def load_attributes_from_response(response) if !response.body.nil? && response.body.strip.size > 0 load(self.class.format.decode(response.body)) 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.
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/remotable/active_resource_fixes.rb', line 43 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 |