Module: Gearhead::Extensions::Associations

Included in:
Gear
Defined in:
lib/gearhead/extensions/associations.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



4
5
6
# File 'lib/gearhead/extensions/associations.rb', line 4

def self.included(klass)
  klass.define_gear_setting :associations, { belongs_to: [], has_many: [], has_one: [] }
end

Instance Method Details

#belongs_to(klass) ⇒ Object



8
9
10
# File 'lib/gearhead/extensions/associations.rb', line 8

def belongs_to(klass)
  @_gear_associations[:belongs_to] << klass
end