class Trole::Mongoid::Config
Public Class Methods
new(subject_class, options = {})
click to toggle source
Calls superclass method
Troles::Common::Config::new
# File lib/trole/adapters/mongoid/config.rb, line 4 def initialize subject_class, options = {} super end
Public Instance Methods
configure_field()
click to toggle source
# File lib/trole/adapters/mongoid/config.rb, line 18 def configure_field type = case strategy when :bit_one Boolean when :string_one String end subject_class.send(:field, role_field, type) if type end
configure_relation()
click to toggle source
# File lib/trole/adapters/mongoid/config.rb, line 8 def configure_relation case strategy when :ref_one has_one_for subject_class, object_model belongs_to_for object_model, subject_class when :embed_one embeds_one subject_class, object_model end end
Protected Instance Methods
embeds_one(from, to)
click to toggle source
# File lib/trole/adapters/mongoid/config.rb, line 30 def embeds_one from, to make_relationship :embeds_one, from, to end