Module: ActiveFixture::Associations::ClassMethods
- Defined in:
- lib/active_fixture/associations.rb
Instance Method Summary collapse
Instance Method Details
#has_many(model) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/active_fixture/associations.rb', line 9 def has_many(model) class_name = model.to_s.camelize.singularize foreign_key = self.name.to_s.underscore + '_id' define_method model do class_name.constantize.find_by foreign_key, self.id end end |