Module: RESTFramework::Mixins::CreateModelMixin

Included in:
ModelControllerMixin
Defined in:
lib/rest_framework/mixins/model_controller_mixin.rb

Overview

Mixin for creating records.

Instance Method Summary collapse

Instance Method Details

#createObject



766
767
768
# File 'lib/rest_framework/mixins/model_controller_mixin.rb', line 766

def create
  render(api: self.create!, status: :created)
end

#create!Object

Perform the ‘create!` call and return the created record.



771
772
773
# File 'lib/rest_framework/mixins/model_controller_mixin.rb', line 771

def create!
  self.get_create_from.create!(self.get_create_params)
end