Handle rails 6 deprecation of update_attributes to update

This commit is contained in:
Eric 2020-05-20 16:03:16 -05:00
parent 0248fb5663
commit 7ccd6870aa
16 changed files with 17 additions and 17 deletions

View file

@ -67,7 +67,7 @@ class CampaignsController < ApplicationController
Time.use_zone(current_nonprofit.timezone || 'UTC') do
campaign_params[:end_datetime] = Chronic.parse(campaign_params[:end_datetime]) if campaign_params[:end_datetime].present?
end
current_campaign.update_attributes campaign_params
current_campaign.update campaign_params
json_saved current_campaign, 'Successfully updated!'
end

View file

@ -46,7 +46,7 @@ class EventsController < ApplicationController
event_params[:start_datetime] = Chronic.parse(event_params[:start_datetime]) if event_params[:start_datetime].present?
event_params[:end_datetime] = Chronic.parse(event_params[:end_datetime]) if event_params[:end_datetime].present?
end
current_event.update_attributes(event_params)
current_event.update(event_params)
json_saved current_event, 'Successfully updated'
end

View file

@ -46,7 +46,7 @@ module Nonprofits
def update
@payment = current_nonprofit.payments.find(params[:id])
@payment.update_attributes(payment_params)
@payment.update(payment_params)
json_saved @payment
end

View file

@ -57,7 +57,7 @@ class NonprofitsController < ApplicationController
def update
flash[:notice] = 'Update successful!'
current_nonprofit.update_attributes nonprofit_params.except(:verification_status)
current_nonprofit.update nonprofit_params.except(:verification_status)
json_saved current_nonprofit
end

View file

@ -47,7 +47,7 @@ class ProfilesController < ApplicationController
else
current_user.profile
end
@profile.update_attributes(profile_params)
@profile.update(profile_params)
json_saved @profile, 'Profile updated'
end

View file

@ -22,7 +22,7 @@ class TicketLevelsController < ApplicationController
end
def update
current_ticket_level.update_attributes ticket_level_params
current_ticket_level.update ticket_level_params
json_saved current_ticket_level, 'Ticket level updated'
end

View file

@ -48,7 +48,7 @@ class TicketsController < ApplicationController
# PUT nonprofits/:nonprofit_id/events/:event_id/tickets/:id/add_note
def add_note
current_nonprofit.tickets.find(params[:id]).update_attributes(note: ticket_params[:note])
current_nonprofit.tickets.find(params[:id]).update(note: ticket_params[:note])
render json: {}
end

View file

@ -25,7 +25,7 @@ class Users::ConfirmationsController < Devise::ConfirmationsController
def confirm
@user = User.find(params[:id])
if @user.valid? && @user.update_attributes(params[:user].except(:confirmation_token))
if @user.valid? && @user.update(params[:user].except(:confirmation_token))
flash[:notice] = 'Your account is all set!'
sign_in @user
redirect_to session[:donor_signup_url] || root_url

View file

@ -31,7 +31,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
if current_user.pending_password && params[:user][:password] && params[:user][:password_confirmation]
params[:user][:pending_password] = false
end
success = current_user.update_attributes(params[:user])
success = current_user.update(params[:user])
errs = current_user.errors.full_messages
else
success = false

View file

@ -25,7 +25,7 @@ module CancelBillingSubscription
end
billing_plan_id = Settings.default_bp.id
billing_subscription.update_attributes(
billing_subscription.update(
billing_plan_id: billing_plan_id,
status: 'active'
)

View file

@ -19,7 +19,7 @@ module CreateCampaign
# json_saved campaign, 'Campaign created! Well done.'
else
profile_id = params[:campaign][:profile_id]
Profile.find(profile_id).update_attributes params[:profile]
Profile.find(profile_id).update params[:profile]
return CreatePeerToPeerCampaign.create(params[:campaign], profile_id)
end
end

View file

@ -22,7 +22,7 @@ module CreateCustomFieldJoin
custom_fields.each do |custom_field|
existing = supporter.custom_field_joins.find_by_custom_field_master_id(custom_field[:custom_field_master_id])
if existing
existing.update_attributes(
existing.update(
custom_field_master_id: custom_field[:custom_field_master_id],
value: custom_field[:value]
)

View file

@ -75,7 +75,7 @@ module PayRecurringDonation
'old_donation' => true
))
if result['charge']['status'] != 'failed'
rd.update_attributes(n_failures: 0)
rd.update(n_failures: 0)
result['recurring_donation'] = rd
HoudiniEventPublisher.announce(:recurring_donation_payment_succeeded, donation, donation&.supporter&.locale || 'en')
InsertActivities.for_recurring_donations([result['payment']['id']])

View file

@ -3,7 +3,7 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
module UpdateCampaignGiftOption
def self.update(gift_option, params)
gift_option.update_attributes params
gift_option.update params
gift_option
end
end

View file

@ -105,13 +105,13 @@ module UpdateRecurringDonations
def self.update(rd, params)
params = set_defaults(params)
if params[:donation]
rd.donation.update_attributes(params[:donation])
rd.donation.update(params[:donation])
return rd.donation unless rd.donation.valid?
params = params.except(:donation)
end
rd.update_attributes(params)
rd.update(params)
rd
end

View file

@ -3,7 +3,7 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
module UpdateSupporter
def self.from_info(supporter, params)
supporter.update_attributes(params)
supporter.update(params)
# GeocodeModel.delay.geocode(supporter)
supporter
end