replace deprecated update_attributes with update
This commit is contained in:
parent
eb45a2bf21
commit
3ffdb424d5
28 changed files with 52 additions and 53 deletions
|
|
@ -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