class Her::Model::Associations::Association
Attributes
params[RW]
@private
Public Instance Methods
blank_relation()
click to toggle source
Reset params when directly called on association class def where(*args)
blank_relation.params = {} blank_relation.where(*args)
end
# File lib/her_extension/model/associations/association.rb, line 48 def blank_relation @blank_relation ||= Relation.new(self) @blank_relation.params = {} @blank_relation end
build_request_path(params = {})
click to toggle source
Required by Relation
methods
# File lib/her_extension/model/associations/association.rb, line 11 def build_request_path(params = {}) build_association_path lambda { "#{@parent.request_path(@params.merge(params))}#{@opts[:path]}" } end
method_for(meth)
click to toggle source
Required by Relation
methods
# File lib/her_extension/model/associations/association.rb, line 16 def method_for(meth) @parent.class.method_for(meth) end
method_missing(name, *args, &block)
click to toggle source
# File lib/her_extension/model/associations/association.rb, line 54 def method_missing(name, *args, &block) blank_relation.send(name, *args, &block) end
new_collection(parsed_data)
click to toggle source
Required by Relation
methods
# File lib/her_extension/model/associations/association.rb, line 26 def new_collection(parsed_data) Her::Model::Attributes.initialize_collection(@klass, parsed_data) end
reload()
click to toggle source
Reload the association from remote service
# File lib/her_extension/model/associations/association.rb, line 36 def reload @klass.get(build_request_path, @params).tap do |result| @parent.attributes[@name] = result end end
request(*args,&block)
click to toggle source
Required by Relation
methods
# File lib/her_extension/model/associations/association.rb, line 21 def request(*args,&block) @parent.class.request(*args,&block) end
to_params(attributes)
click to toggle source
Properly format the attributes to post/put
# File lib/her_extension/model/associations/association.rb, line 31 def to_params(attributes) @parent.class.to_params(attributes,attributes) end