Sha256: 4c78cb17b2c8af8af830ce080cc879fd6961f84152a1b7ba39290db4494b4853
Contents?: true
Size: 986 Bytes
Versions: 1
Compression:
Stored size: 986 Bytes
Contents
module RademadeAdmin module Model module DataAdapter def initialize(model) @model = model end def relations @model.relations end def reflect_on_association(name) nil end def association_foreign_key(relation) nil end def fields [] end def has_field?(field) false end def foreign_key?(field) false end def has_many @has_many_relations ||= relations_with_types has_many_relations end def has_one @has_one_relations ||= relations_with_types has_one_relations end protected def relations_with_types(types) @model.reflect_on_all_associations(types).map do |relation| relation[:class_name] || relation[:name].to_s.capitalize end end def has_many_relations [] end def has_one_relations [] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rademade_admin-0.0.1 | lib/rademade_admin/model/data_adapter.rb |