Sha256: c751c18a24a8e983895855674e04b3f69123b7472f9ffaa3c732c124ee545cc4
Contents?: true
Size: 850 Bytes
Versions: 5
Compression:
Stored size: 850 Bytes
Contents
class ManyStoreAssociation < Association include StoreAssociation include ManyAssociation def default_input_type :store_many end def typecast(value, record) return ChangeSensitiveArray.new(record, name, []) if value.blank? raise "ManyStoreAssociation values must be enumerable (#{name})" unless value.respond_to?(:each) ChangeSensitiveArray.new(record, name, all(value, record)) end def untypecast(value, record) return nil if value.blank? raise "ManyStoreAssociation values must be enumerable (#{name})" unless value.respond_to?(:each) store = record.get_raw(name) || [] store.clear value.each do |associated_record| store << associated_record.id end store end def default @options['default'] || [] end end Field::TYPES['many_store'] = ManyStoreAssociation
Version data entries
5 entries across 5 versions & 1 rubygems