Method: LazyRecord::Collections#_define_collection_setter
- Defined in:
- lib/lazy_record/collections.rb
#_define_collection_setter(collection, options) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/lazy_record/collections.rb', line 22 def _define_collection_setter(collection, ) klass = lazy_const_get_one_level_back([:class_name]).call module_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{collection}=(coll) @#{collection} = Relation.new(klass: #{klass}, collection: coll) end RUBY end |