Class: Machinist::ActiveResourceAdapter
- Inherits:
-
Object
- Object
- Machinist::ActiveResourceAdapter
- Defined in:
- lib/machinist_activeresource.rb
Class Method Summary collapse
-
.assigned_attributes_without_associations(lathe) ⇒ Object
This method takes care of converting any associated objects, in the hash returned by Lathe#assigned_attributes, into their object ids.
- .has_association?(object, attribute) ⇒ Boolean
Class Method Details
.assigned_attributes_without_associations(lathe) ⇒ Object
This method takes care of converting any associated objects, in the hash returned by Lathe#assigned_attributes, into their object ids.
For example, let’s say we have blueprints like this:
Post.blueprint { }
Comment.blueprint { post }
Lathe#assigned_attributes will return { :post => … }, but we want to pass { :post_id => 1 } to a controller.
This method takes care of cleaning this up.
31 32 33 34 35 36 37 |
# File 'lib/machinist_activeresource.rb', line 31 def self.assigned_attributes_without_associations(lathe) attributes = {} lathe.assigned_attributes.each_pair do |attribute, value| attributes[attribute] = value end attributes end |
.has_association?(object, attribute) ⇒ Boolean
9 10 11 |
# File 'lib/machinist_activeresource.rb', line 9 def self.has_association?(object, attribute) false end |