Class: Trole::Adapters::ActiveRecord::Config
- Inherits:
-
Troles::Common::Config
- Object
- Troles::Common::Config
- Trole::Adapters::ActiveRecord::Config
- Defined in:
- lib/trole/adapters/active_record/config.rb
Instance Attribute Summary
Attributes inherited from Troles::Common::Config
#generic, #log_on, #orm, #strategy, #subject_class
Attributes included from Troles::Common::Config::ClassMethods
#auto_load, #default_orm, #log_on
Instance Method Summary collapse
-
#configure_field ⇒ Object
AR sets this up on its own using DB Table info.
- #configure_relation ⇒ Object
-
#initialize(subject_class, options = {}) ⇒ Config
constructor
A new instance of Config.
- #main_field ⇒ Object
- #obj_model ⇒ Object
- #subj_model ⇒ Object
Methods inherited from Troles::Common::Config
#apply_options!, #auto_config, #auto_config?, #configure!, #default_main_field, #generic?, #log_on?, #main_field=, #singularity, sub_modules
Methods included from Troles::Common::Config::ClassMethods
#auto_config, #auto_config?, #auto_load?, #log_on?
Constructor Details
#initialize(subject_class, options = {}) ⇒ Config
Returns a new instance of Config.
4 5 6 7 8 |
# File 'lib/trole/adapters/active_record/config.rb', line 4 def initialize subject_class, = {} super puts "models classes: #{subject_class}, #{object_model}" @models = ::Schemaker::Models.new(subject_class, object_model, nil) end |
Instance Method Details
#configure_field ⇒ Object
AR sets this up on its own using DB Table info
34 35 |
# File 'lib/trole/adapters/active_record/config.rb', line 34 def configure_field end |
#configure_relation ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/trole/adapters/active_record/config.rb', line 10 def configure_relation case strategy when :ref_one obj_model.create_belongs_to subject_class, :key => main_field subj_model.create_has_one object_model when :embed_one raise "EmbedOne is currently not supported by the Active Record adapter. It will be soon..." #clazz.send(:embeds_one, role_model_key, :class_name => role_model_class_name) end end |
#main_field ⇒ Object
29 30 31 |
# File 'lib/trole/adapters/active_record/config.rb', line 29 def main_field role_field end |
#obj_model ⇒ Object
21 22 23 |
# File 'lib/trole/adapters/active_record/config.rb', line 21 def obj_model models.object_model end |
#subj_model ⇒ Object
25 26 27 |
# File 'lib/trole/adapters/active_record/config.rb', line 25 def subj_model models.subject_model end |