Class: Trole::ActiveRecord::Config

Inherits:
Troles::Common::Config show all
Defined in:
lib/trole/adapters/active_record/config.rb

Instance Attribute Summary

Attributes inherited from Troles::Common::Config

#auto_relations, #generic, #log_on, #orm, #strategy, #subject_class

Instance Method Summary collapse

Methods inherited from Troles::Common::Config

#apply_options!, #auto_config, auto_config, auto_config?, #auto_config?, #auto_config_setings, auto_load?, #configure!, #default_role_field, #generic?, #log_on?, log_on?, #role_field, #role_field=, #singularity, sub_modules

Constructor Details

#initialize(subject_class, options = {}) ⇒ Config

Returns a new instance of Config.



4
5
6
# File 'lib/trole/adapters/active_record/config.rb', line 4

def initialize subject_class, options = {}
  super
end

Instance Method Details

#configure_fieldObject

AR sets this up ont its own using DB Table info



20
21
# File 'lib/trole/adapters/active_record/config.rb', line 20

def configure_field
end

#configure_relationObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/trole/adapters/active_record/config.rb', line 8

def configure_relation
  case strategy
  when :ref_one
    belongs_to_for subject_class, object_model, :key => main_field 
    has_many_for object_model, subject_class
  when :embed_one
    raise "EmbedOne is currently not supported by the Active Record adapter. It will be soon..."
    #clazz.send(:embeds_many, role_model_key, :class_name => role_model_class_name)      
  end
end