Class: Bricks::Adapters::ActiveRecord::Association
- Inherits:
-
Object
- Object
- Bricks::Adapters::ActiveRecord::Association
- Defined in:
- lib/bricks/adapters/active_record.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(klass, kind) ⇒ Association
constructor
A new instance of Association.
- #klass ⇒ Object
Constructor Details
#initialize(klass, kind) ⇒ Association
Returns a new instance of Association.
10 11 12 13 14 15 16 17 |
# File 'lib/bricks/adapters/active_record.rb', line 10 def initialize(klass, kind) @class = klass @type = case kind when :belongs_to; :parent when :has_many, :has_and_belongs_to_many; :children else "Unknown AR association type: #{kind}." end end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/bricks/adapters/active_record.rb', line 8 def type @type end |
Instance Method Details
#klass ⇒ Object
19 20 21 |
# File 'lib/bricks/adapters/active_record.rb', line 19 def klass @class end |