replace update_attributes with updat since deprecated
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
85270e70cf
commit
af3444bba6
25 changed files with 42 additions and 42 deletions
|
|
@ -23,7 +23,7 @@ class Admin::BankAccountsController < Admin::BaseController
|
|||
def update
|
||||
@bank_account = BankAccount.find(params[:id])
|
||||
|
||||
if @bank_account.update_attributes(params[:bank_account])
|
||||
if @bank_account.update(params[:bank_account])
|
||||
redirect_to update_bank_accounts_admin_finances_url, :status => 303
|
||||
else
|
||||
render :action => 'new', :layout => false
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class Admin::FinancialTransactionClassesController < Admin::BaseController
|
|||
def update
|
||||
@financial_transaction_class = FinancialTransactionClass.find(params[:id])
|
||||
|
||||
if @financial_transaction_class.update_attributes(params[:financial_transaction_class])
|
||||
if @financial_transaction_class.update(params[:financial_transaction_class])
|
||||
redirect_to update_transaction_types_admin_finances_url, status: 303
|
||||
else
|
||||
render action: 'new', layout: false
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class Admin::FinancialTransactionTypesController < Admin::BaseController
|
|||
def update
|
||||
@financial_transaction_type = FinancialTransactionType.find(params[:id])
|
||||
|
||||
if @financial_transaction_type.update_attributes(params[:financial_transaction_type])
|
||||
if @financial_transaction_type.update(params[:financial_transaction_type])
|
||||
redirect_to update_transaction_types_admin_finances_url, status: 303
|
||||
else
|
||||
render action: 'new', layout: false
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Api::V1::User::GroupOrderArticlesController < Api::V1::BaseController
|
|||
goa.update_quantities((create_params[:quantity] || 0).to_i, (create_params[:tolerance] || 0).to_i)
|
||||
oa.update_results!
|
||||
go.update_price!
|
||||
go.update_attributes! updated_by: current_user
|
||||
go.update! updated_by: current_user
|
||||
end
|
||||
render_goa_with_oa(goa)
|
||||
end
|
||||
|
|
@ -38,7 +38,7 @@ class Api::V1::User::GroupOrderArticlesController < Api::V1::BaseController
|
|||
goa.update_quantities((update_params[:quantity] || goa.quantity).to_i, (update_params[:tolerance] || goa.tolerance).to_i)
|
||||
goa.order_article.update_results!
|
||||
goa.group_order.update_price!
|
||||
goa.group_order.update_attributes! updated_by: current_user
|
||||
goa.group_order.update! updated_by: current_user
|
||||
end
|
||||
render_goa_with_oa(goa)
|
||||
end
|
||||
|
|
@ -50,7 +50,7 @@ class Api::V1::User::GroupOrderArticlesController < Api::V1::BaseController
|
|||
goa.destroy!
|
||||
goa.order_article.update_results!
|
||||
goa.group_order.update_price!
|
||||
goa.group_order.update_attributes! updated_by: current_user
|
||||
goa.group_order.update! updated_by: current_user
|
||||
end
|
||||
render_goa_with_oa(nil, goa.order_article)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class ArticlesController < ApplicationController
|
|||
def update
|
||||
@article = Article.find(params[:id])
|
||||
|
||||
if @article.update_attributes(params[:article])
|
||||
if @article.update(params[:article])
|
||||
render :layout => false
|
||||
else
|
||||
render :action => 'new', :layout => false
|
||||
|
|
@ -93,7 +93,7 @@ class ArticlesController < ApplicationController
|
|||
# Update other article attributes...
|
||||
@articles = Article.find(params[:articles].keys)
|
||||
@articles.each do |article|
|
||||
unless article.update_attributes(params[:articles][article.id.to_s])
|
||||
unless article.update(params[:articles][article.id.to_s])
|
||||
invalid_articles = true unless invalid_articles # Remember that there are validation errors
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class DeliveriesController < ApplicationController
|
|||
def update
|
||||
@delivery = Delivery.find(params[:id])
|
||||
|
||||
if @delivery.update_attributes(params[:delivery])
|
||||
if @delivery.update(params[:delivery])
|
||||
flash[:notice] = I18n.t('deliveries.update.notice')
|
||||
redirect_to [@supplier, @delivery]
|
||||
else
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class Finance::BalancingController < Finance::BaseController
|
|||
|
||||
def update_note
|
||||
@order = Order.find(params[:id])
|
||||
if @order.update_attributes(params[:order])
|
||||
if @order.update(params[:order])
|
||||
render :layout => false
|
||||
else
|
||||
render :action => :edit_note, :layout => false
|
||||
|
|
@ -65,7 +65,7 @@ class Finance::BalancingController < Finance::BaseController
|
|||
|
||||
def update_transport
|
||||
@order = Order.find(params[:id])
|
||||
@order.update_attributes! params[:order]
|
||||
@order.update! params[:order]
|
||||
redirect_to new_finance_order_path(order_id: @order.id)
|
||||
rescue => error
|
||||
redirect_to new_finance_order_path(order_id: @order.id), alert: t('errors.general_msg', msg: error.message)
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class Finance::InvoicesController < ApplicationController
|
|||
end
|
||||
|
||||
def update
|
||||
if @invoice.update_attributes(params[:invoice])
|
||||
if @invoice.update(params[:invoice])
|
||||
redirect_to [:finance, @invoice], notice: I18n.t('finance.update.notice')
|
||||
else
|
||||
fill_deliveries_and_orders_collection @invoice.id, @invoice.supplier_id
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class Foodcoop::WorkgroupsController < ApplicationController
|
|||
|
||||
def update
|
||||
@workgroup = Workgroup.find(params[:id])
|
||||
if @workgroup.update_attributes(params[:workgroup])
|
||||
if @workgroup.update(params[:workgroup])
|
||||
redirect_to foodcoop_workgroups_url, :notice => I18n.t('workgroups.update.notice')
|
||||
else
|
||||
render :action => 'edit'
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class GroupOrderArticlesController < ApplicationController
|
|||
goa = GroupOrderArticle.where(group_order_id: @group_order_article.group_order_id,
|
||||
order_article_id: @order_article.id).first
|
||||
|
||||
if goa && goa.update_attributes(params[:group_order_article])
|
||||
if goa && goa.update(params[:group_order_article])
|
||||
@group_order_article = goa
|
||||
|
||||
update_summaries(@group_order_article)
|
||||
|
|
@ -38,7 +38,7 @@ class GroupOrderArticlesController < ApplicationController
|
|||
if params[:delta]
|
||||
@group_order_article.update_attribute :result, [@group_order_article.result + params[:delta].to_f, 0].max
|
||||
else
|
||||
@group_order_article.update_attributes(params[:group_order_article])
|
||||
@group_order_article.update(params[:group_order_article])
|
||||
end
|
||||
|
||||
update_summaries(@group_order_article)
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ class HomeController < ApplicationController
|
|||
end
|
||||
|
||||
def update_profile
|
||||
if @current_user.update_attributes(user_params)
|
||||
@current_user.ordergroup.update_attributes(ordergroup_params) if ordergroup_params
|
||||
if @current_user.update(user_params)
|
||||
@current_user.ordergroup.update(ordergroup_params) if ordergroup_params
|
||||
session[:locale] = @current_user.locale
|
||||
redirect_to my_profile_url, notice: I18n.t('home.changes_saved')
|
||||
else
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class OrdersController < ApplicationController
|
|||
# Update an existing order.
|
||||
def update
|
||||
@order = Order.find params[:id]
|
||||
if @order.update_attributes params[:order].merge(updated_by: current_user)
|
||||
if @order.update params[:order].merge(updated_by: current_user)
|
||||
flash[:notice] = I18n.t('orders.update.notice')
|
||||
redirect_to :action => 'show', :id => @order
|
||||
else
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class StockitController < ApplicationController
|
|||
|
||||
def update
|
||||
@stock_article = StockArticle.find(params[:id])
|
||||
@stock_article.update_attributes!(params[:stock_article])
|
||||
@stock_article.update!(params[:stock_article])
|
||||
render :layout => false
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
render :action => 'edit', :layout => false
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class SuppliersController < ApplicationController
|
|||
|
||||
def update
|
||||
@supplier = Supplier.find(params[:id])
|
||||
if @supplier.update_attributes(supplier_params)
|
||||
if @supplier.update(supplier_params)
|
||||
flash[:notice] = I18n.t('suppliers.update.notice')
|
||||
redirect_to @supplier
|
||||
else
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class BankTransaction < ApplicationRecord
|
|||
|
||||
transaction do
|
||||
link = FinancialLink.new
|
||||
invoices.each { |i| i.update_attributes! financial_link: link, paid_on: date }
|
||||
invoices.each { |i| i.update! financial_link: link, paid_on: date }
|
||||
update_attribute :financial_link, link
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ class Order < ApplicationRecord
|
|||
unless finished?
|
||||
Order.transaction do
|
||||
# set new order state (needed by notify_order_finished)
|
||||
update_attributes!(:state => 'finished', :ends => Time.now, :updated_by => user)
|
||||
update!(:state => 'finished', :ends => Time.now, :updated_by => user)
|
||||
|
||||
# Update order_articles. Save the current article_price to keep price consistency
|
||||
# Also save results for each group_order_result
|
||||
|
|
@ -281,7 +281,7 @@ class Order < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
self.update_attributes! :state => 'closed', :updated_by => user, :foodcoop_result => profit
|
||||
self.update! :state => 'closed', :updated_by => user, :foodcoop_result => profit
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -290,7 +290,7 @@ class Order < ApplicationRecord
|
|||
raise I18n.t('orders.model.error_closed') if closed?
|
||||
|
||||
comments.create(user: user, text: I18n.t('orders.model.close_direct_message')) unless FoodsoftConfig[:charge_members_manually]
|
||||
update_attributes! state: 'closed', updated_by: user
|
||||
update! state: 'closed', updated_by: user
|
||||
end
|
||||
|
||||
def send_to_supplier!(user)
|
||||
|
|
|
|||
|
|
@ -159,10 +159,10 @@ class OrderArticle < ApplicationRecord
|
|||
def update_article_and_price!(order_article_attributes, article_attributes, price_attributes = nil)
|
||||
OrderArticle.transaction do
|
||||
# Updates self
|
||||
self.update_attributes!(order_article_attributes)
|
||||
self.update!(order_article_attributes)
|
||||
|
||||
# Updates article
|
||||
article.update_attributes!(article_attributes)
|
||||
article.update!(article_attributes)
|
||||
|
||||
# Updates article_price belonging to current order article
|
||||
if price_attributes.present?
|
||||
|
|
@ -170,7 +170,7 @@ class OrderArticle < ApplicationRecord
|
|||
if article_price.changed?
|
||||
# Updates also price attributes of article if update_global_price is selected
|
||||
if update_global_price
|
||||
article.update_attributes!(price_attributes)
|
||||
article.update!(price_attributes)
|
||||
self.article_price = article.article_prices.first and save # Assign new created article price to order article
|
||||
else
|
||||
# Creates a new article_price if neccessary
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue