class OData::ActiveRecordSchema::Base
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
OData::AbstractSchema::Base::new
# File lib/o_data/active_record_schema/base.rb, line 12 def initialize(*args) super(*args) Dir.glob(RAILS_ROOT + '/app/models/*.rb').each { |file| require file } Object.subclasses_of(ActiveRecord::Base).collect { |active_record| self.EntityType(active_record, :reflect_on_associations => false) }.collect { |entity_type| entity_type.active_record.reflect_on_all_associations.each do |reflection| entity_type.NavigationProperty(reflection) end } end
Public Instance Methods
Association(*args)
click to toggle source
# File lib/o_data/active_record_schema/base.rb, line 26 def Association(*args) Association.new(self, *args) end
EntityType(*args)
click to toggle source
# File lib/o_data/active_record_schema/base.rb, line 30 def EntityType(*args) entity_type = EntityType.new(self, *args) self.entity_types << entity_type entity_type end
find_entity_type(options = {})
click to toggle source
Calls superclass method
OData::AbstractSchema::Base#find_entity_type
# File lib/o_data/active_record_schema/base.rb, line 4 def find_entity_type(options = {}) if options[:active_record] self.entity_types.find { |et| et.name == EntityType.name_for(options[:active_record]) } else super(options) end end