Module: Flatter::Mapper::Collection::FactoryMethods
- Included in:
- Factory
- Defined in:
- lib/flatter/mapper/collection.rb
Instance Method Summary collapse
Instance Method Details
#collection? ⇒ Boolean
20 21 22 23 |
# File 'lib/flatter/mapper/collection.rb', line 20 def collection? [:collection] == true || ([:collection] != false && name == name.pluralize) end |
#create ⇒ Object
10 11 12 13 14 |
# File 'lib/flatter/mapper/collection.rb', line 10 def create(*) super.tap do |mapper| mapper..merge!(collection: collection?) end end |
#default_mapper_class_name ⇒ Object
16 17 18 |
# File 'lib/flatter/mapper/collection.rb', line 16 def default_mapper_class_name collection? ? "#{name.singularize.camelize}Mapper" : super end |