Module: Backframe::ActsAsResource::Actions::Update

Defined in:
lib/backframe/actioncontroller/acts_as_resource/actions.rb

Instance Method Summary collapse

Instance Method Details

#updateObject



50
51
52
53
54
55
56
57
58
59
# File 'lib/backframe/actioncontroller/acts_as_resource/actions.rb', line 50

def update
  if @item.update_attributes(allowed_params)
    if @item.respond_to?(:activities)
      Activity.create!(subject: current_user, text: 'updated {object1}', object1: @item)
    end
    render json: @item
  else
    resource_error_response(@item, 422)
  end
end