Module: ElocalApiSupport::Actions::Update

Defined in:
lib/elocal_api_support/actions/update.rb

Constant Summary collapse

DEFAULT_IGNORED_PARAMETERS =
%w(id created_at updated_at).freeze

Instance Method Summary collapse

Instance Method Details

#updateObject



8
9
10
11
12
13
14
15
16
# File 'lib/elocal_api_support/actions/update.rb', line 8

def update
  if lookup_object.update_attributes(parameters_available_for_update)
    render json: lookup_object
  else
    Rails.logger.info { "There was an issue updating model #{lookup_object}" }
    Rails.logger.debug { "Error details #{lookup_object.errors.to_xml}" }
    render json: { errors: lookup_object.errors }, status: 422
  end
end