Change update_attributes to update

This commit is contained in:
1resu 2021-12-18 15:05:53 +01:00
parent 6340e224ed
commit c7a74c8e7d
4 changed files with 4 additions and 4 deletions

View file

@ -70,7 +70,7 @@ class ArticlesController < ApplicationController
def update def update
@article = @supplier.articles.find(params[:id]) @article = @supplier.articles.find(params[:id])
respond_to do |format| respond_to do |format|
if @article.update_attributes(params[:article]) if @article.update(params[:article])
flash[:notice] = 'Article was successfully updated.' flash[:notice] = 'Article was successfully updated.'
format.html { redirect_to supplier_article_url(@article.supplier, @article) } format.html { redirect_to supplier_article_url(@article.supplier, @article) }
format.xml { head :ok } format.xml { head :ok }

View file

@ -64,7 +64,7 @@ class SuppliersController < ApplicationController
# don't set password to blank on saving # don't set password to blank on saving
attrs = attrs.reject {|k,v| k == 'ftp_password' } if attrs[:ftp_password].blank? attrs = attrs.reject {|k,v| k == 'ftp_password' } if attrs[:ftp_password].blank?
if @supplier.update_attributes(attrs) if @supplier.update(attrs)
flash[:notice] = 'Supplier was successfully updated.' flash[:notice] = 'Supplier was successfully updated.'
format.html { redirect_to supplier_url(@supplier) } format.html { redirect_to supplier_url(@supplier) }
format.xml { head :ok } format.xml { head :ok }

View file

@ -92,7 +92,7 @@ class Supplier < ActiveRecord::Base
# update existing article # update existing article
elsif status.nil? && article elsif status.nil? && article
updated_counter += 1 if article.update_attributes(parsed_article) updated_counter += 1 if article.update(parsed_article)
listed << article.id listed << article.id
# delete outlisted article # delete outlisted article

View file

@ -7,7 +7,7 @@ class AddSaltToSuppliers < ActiveRecord::Migration
Supplier.find_each do |supplier| Supplier.find_each do |supplier|
salt = [Array.new(6){rand(256).chr}.join].pack("m").chomp salt = [Array.new(6){rand(256).chr}.join].pack("m").chomp
supplier.update_attributes! salt: salt supplier.update! salt: salt
end end
change_column_null :suppliers, :salt, false change_column_null :suppliers, :salt, false