Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
Added ! to update calls where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrei committed Oct 27, 2016
1 parent 926e9fa commit 2ec2536
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion app/controllers/plugins/petitions_controller.rb
Expand Up @@ -4,7 +4,9 @@ class Plugins::PetitionsController < ApplicationController

def update
@plugin = Plugins::Petition.find(params[:id])
@plugin.update_attributes(permitted_params)
# TODO; check for update result and return 422
# in case of error.
@plugin.update(permitted_params)
@page = @plugin.page

respond_to do |format|
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/plugins/surveys_controller.rb
Expand Up @@ -20,7 +20,7 @@ def add_form
def sort_forms
ids = params[:form_ids].split(',')
ids.each_with_index do |id, index|
Form.where(id: id).first.update_attributes(position: index)
Form.where(id: id).first.update!(position: index)
end

head :ok
Expand Down
4 changes: 2 additions & 2 deletions app/models/payment/go_cardless.rb
Expand Up @@ -7,13 +7,13 @@ def table_name_prefix

def write_customer(customer_gc_id, member_id)
local_customer = Payment::GoCardless::Customer.find_or_initialize_by(go_cardless_id: customer_gc_id)
local_customer.update_attributes(member_id: member_id)
local_customer.update!(member_id: member_id)
local_customer
end

def write_mandate(mandate_gc_id, scheme, next_possible_charge_date, customer_id)
local_mandate = Payment::GoCardless::PaymentMethod.find_or_initialize_by(go_cardless_id: mandate_gc_id)
local_mandate.update_attributes(scheme: scheme, next_possible_charge_date: next_possible_charge_date, customer_id: customer_id)
local_mandate.update!(scheme: scheme, next_possible_charge_date: next_possible_charge_date, customer_id: customer_id)
local_mandate
end

Expand Down

0 comments on commit 2ec2536

Please sign in to comment.