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



261
262
263
# File 'lib/rest_framework/controller_mixins/models.rb', line 261

def update
  api_response(self.update!)
end

#update!Object



265
266
267
268
269
# File 'lib/rest_framework/controller_mixins/models.rb', line 265

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