Module: Komagire::ActiveRecordExtension
- Defined in:
- lib/komagire/active_record_extension.rb
Instance Method Summary collapse
- #composed_of_komagire_id_list(part_id, attribute, content_class_name, options = {}) ⇒ Object
- #composed_of_komagire_key_list(part_id, attribute, content_class_name, content_class_attribute, options = {}) ⇒ Object
Instance Method Details
#composed_of_komagire_id_list(part_id, attribute, content_class_name, options = {}) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/komagire/active_record_extension.rb', line 32 def composed_of_komagire_id_list(part_id, attribute, content_class_name, ={}) = .delete(:komagire) || {} = { class_name: 'Komagire::IdList', mapping: [[attribute.to_s, 'csids']], allow_nil: false, constructor: lambda { |cskeys| Komagire::IdList.new(content_class_name, cskeys, ) }, converter: lambda { |value| Komagire::IdList.new(content_class_name, value, ) }, }.merge() composed_of part_id, end |
#composed_of_komagire_key_list(part_id, attribute, content_class_name, content_class_attribute, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/komagire/active_record_extension.rb', line 11 def composed_of_komagire_key_list(part_id, attribute, content_class_name, content_class_attribute, ={}) = .delete(:komagire) || {} = { class_name: 'Komagire::KeyList', mapping: [[attribute.to_s, 'cskeys']], allow_nil: false, constructor: lambda { |cskeys| Komagire::KeyList.new(content_class_name, content_class_attribute, cskeys, ) }, converter: lambda { |value| Komagire::KeyList.new(content_class_name, content_class_attribute, value, ) }, }.merge() composed_of part_id, end |