Class: Backstage::AssociationConfig
- Inherits:
-
Object
- Object
- Backstage::AssociationConfig
- Defined in:
- lib/backstage/association_config.rb
Instance Attribute Summary collapse
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #associated_class ⇒ Object
- #class_name ⇒ Object
- #display_column ⇒ Object
- #foreign_key ⇒ Object
- #image_col ⇒ Object
-
#initialize(name, kind, options = {}) ⇒ AssociationConfig
constructor
A new instance of AssociationConfig.
Constructor Details
#initialize(name, kind, options = {}) ⇒ AssociationConfig
Returns a new instance of AssociationConfig.
5 6 7 8 9 |
# File 'lib/backstage/association_config.rb', line 5 def initialize(name, kind, = {}) @name = name.to_sym @kind = kind.to_sym @options = end |
Instance Attribute Details
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
3 4 5 |
# File 'lib/backstage/association_config.rb', line 3 def kind @kind end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/backstage/association_config.rb', line 3 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/backstage/association_config.rb', line 3 def @options end |
Instance Method Details
#associated_class ⇒ Object
23 24 25 |
# File 'lib/backstage/association_config.rb', line 23 def associated_class class_name.constantize end |
#class_name ⇒ Object
19 20 21 |
# File 'lib/backstage/association_config.rb', line 19 def class_name [:class_name] || name.to_s.classify end |
#display_column ⇒ Object
11 12 13 |
# File 'lib/backstage/association_config.rb', line 11 def display_column [:display_column] || :id end |
#foreign_key ⇒ Object
15 16 17 |
# File 'lib/backstage/association_config.rb', line 15 def foreign_key [:foreign_key] || :"#{name}_id" end |
#image_col ⇒ Object
27 28 29 |
# File 'lib/backstage/association_config.rb', line 27 def image_col [:image_col] || :url end |