Sha256: fcfdcc137a33a91424c0a54cf10a40c47087a11b65b431c35746703fbaf3a417
Contents?: true
Size: 984 Bytes
Versions: 1
Compression:
Stored size: 984 Bytes
Contents
module RademadeAdmin module Model module DataAdapter class Mongoid include RademadeAdmin::Model::DataAdapter def relations @model.relations end def reflect_on_association(name) @model.reflect_on_association(name) end def association_foreign_key(relation) rel_name = relation.name.to_s if relation.many? rel_name.singularize.foreign_key + 's' else rel_name.foreign_key end end def fields @model.fields end def has_field?(field) fields.keys.include? field end def foreign_key?(field) field.foreign_key? end protected def has_many_relations [:embeds_many, :has_many, :has_and_belongs_to_many] end def has_one_relations [:has_one, :embeds_one, :belongs_to] end 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/mongoid.rb |