Module: PipeLineDealer::Collection::Concerns::CreateAndUpdate
- Extended by:
- ActiveSupport::Concern
- Included in:
- PipeLineDealer::Collection
- Defined in:
- lib/pipe_line_dealer/collection/concerns/create_and_update.rb
Instance Method Summary collapse
Instance Method Details
#create(attributes = {}) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/pipe_line_dealer/collection/concerns/create_and_update.rb', line 7 def create(attributes = {}) if @options[:new_defaults] attributes = @options[:new_defaults].merge(attributes) end @klass.new(collection: self, record_new: true, attributes: attributes).save end |
#new(attributes = {}) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/pipe_line_dealer/collection/concerns/create_and_update.rb', line 15 def new(attributes = {}) if @options[:new_defaults] attributes = @options[:new_defaults].merge(attributes) end @klass.new(collection: self, record_new: true, attributes: attributes) end |