class OData::ActiveRecordSchema::NavigationProperty
Public Class Methods
association_for(schema, reflection)
click to toggle source
# File lib/o_data/active_record_schema/navigation_property.rb, line 8 def self.association_for(schema, reflection) schema.Association(reflection) end
name_for(reflection)
click to toggle source
# File lib/o_data/active_record_schema/navigation_property.rb, line 4 def self.name_for(reflection) reflection.name.to_s end
new(schema, entity_type, reflection)
click to toggle source
Calls superclass method
OData::AbstractSchema::NavigationProperty::new
# File lib/o_data/active_record_schema/navigation_property.rb, line 12 def initialize(schema, entity_type, reflection) super(schema, entity_type, self.class.name_for(reflection), self.class.association_for(schema, reflection), :source => true) end
Public Instance Methods
find_all(one, key_values = {})
click to toggle source
# File lib/o_data/active_record_schema/navigation_property.rb, line 20 def find_all(one, key_values = {}) results = one.send(method_name) unless key_values.blank? if results.respond_to?(:find) results = results.find(:all, :conditions => self.entity_type.conditions_for_find(key_values)) else # TODO: raise exception if key_values supplied for non-finder method end end results end
find_one(one, key_value = nil)
click to toggle source
# File lib/o_data/active_record_schema/navigation_property.rb, line 32 def find_one(one, key_value = nil) results = one.send(method_name) unless key_value.blank? if results.respond_to?(:find) results = results.find(key_value) else # TODO: raise exception if key_value supplied for non-finder method end end results end
method_name()
click to toggle source
# File lib/o_data/active_record_schema/navigation_property.rb, line 16 def method_name self.association.reflection.name.to_sym end