Module: RESTFramework::UpdateModelMixin

Included in:
ModelControllerMixin
Defined in:
lib/rest_framework/controller_mixins/models.rb

Overview

Mixin for updating records.

Instance Method Summary collapse

Instance Method Details

#updateObject



278
279
280
# File 'lib/rest_framework/controller_mixins/models.rb', line 278

def update
  api_response(self.update!)
end

#update!Object



282
283
284
285
286
# File 'lib/rest_framework/controller_mixins/models.rb', line 282

def update!
  @record ||= self.get_record
  @record.update!(self.get_update_params)
  return self.get_serializer_class.new(@record, controller: self).serialize
end