Class: SimpleMaster::Master::Association
- Inherits:
-
Object
- Object
- SimpleMaster::Master::Association
- Defined in:
- lib/simple_master/master/association.rb,
lib/simple_master/master/association/has_one_association.rb,
lib/simple_master/master/association/has_many_association.rb,
lib/simple_master/master/association/belongs_to_association.rb,
lib/simple_master/master/association/has_many_through_association.rb,
lib/simple_master/master/association/belongs_to_polymorphic_association.rb
Direct Known Subclasses
BelongsToAssociation, BelongsToPolymorphicAssociation, HasManyAssociation, HasManyThroughAssociation, HasOneAssociation
Defined Under Namespace
Classes: BelongsToAssociation, BelongsToPolymorphicAssociation, HasManyAssociation, HasManyThroughAssociation, HasOneAssociation
Instance Attribute Summary collapse
-
#defined_at ⇒ Object
readonly
Returns the value of attribute defined_at.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #init(master_class) ⇒ Object
- #init_for_test(master_class) ⇒ Object
-
#initialize(master_class, name, options) ⇒ Association
constructor
A new instance of Association.
- #is_active_record? ⇒ Boolean
-
#target_class ⇒ Object
Execute after definition phase.
Constructor Details
#initialize(master_class, name, options) ⇒ Association
Returns a new instance of Association.
16 17 18 19 20 |
# File 'lib/simple_master/master/association.rb', line 16 def initialize(master_class, name, ) @name = name @defined_at = master_class = end |
Instance Attribute Details
#defined_at ⇒ Object (readonly)
Returns the value of attribute defined_at.
13 14 15 |
# File 'lib/simple_master/master/association.rb', line 13 def defined_at @defined_at end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/simple_master/master/association.rb', line 12 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
14 15 16 |
# File 'lib/simple_master/master/association.rb', line 14 def end |
Instance Method Details
#init(master_class) ⇒ Object
31 32 |
# File 'lib/simple_master/master/association.rb', line 31 def init(master_class) end |
#init_for_test(master_class) ⇒ Object
34 35 |
# File 'lib/simple_master/master/association.rb', line 34 def init_for_test(master_class) end |
#is_active_record? ⇒ Boolean
27 28 29 |
# File 'lib/simple_master/master/association.rb', line 27 def is_active_record? target_class < ::ActiveRecord::Base end |
#target_class ⇒ Object
Execute after definition phase.
23 24 25 |
# File 'lib/simple_master/master/association.rb', line 23 def target_class @target_class ||= find_class(defined_at, [:class_name] || ActiveSupport::Inflector.classify(name)) end |