Sha256: a3d05a5a37ac847f62d2b0edd6139acb7a7dd983dd9dde4191cfe65b3ba5b141
Contents?: true
Size: 677 Bytes
Versions: 1
Compression:
Stored size: 677 Bytes
Contents
module Trole::Mongoid class Config < Troles::Common::Config def initialize clazz, options = {} super end def configure_relation case strategy when :ref_one has_one_for clazz, :role belongs_to_for role_model, :user when :embed_one embeds_one clazz, :role end end def configure_field type = case strategy when :bit_one Boolean when :string_one String end clazz.send(:field, role_field, type) if type end protected def embeds_one from, to make_relationship :embeds_one, from, to end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
troles-0.5.0 | lib/trole/adapters/mongoid/config.rb |