Move setting availability to sync method
This commit is contained in:
parent
cd164bc3eb
commit
25deefced1
3 changed files with 25 additions and 9 deletions
|
|
@ -181,13 +181,9 @@ class ArticlesController < ApplicationController
|
|||
has_error = true
|
||||
end
|
||||
# Update articles
|
||||
@updated_articles.map{|a| a.save or has_error=true }
|
||||
@updated_articles.each {|a| a.save or has_error=true }
|
||||
# Add new articles
|
||||
@new_articles.each do |article|
|
||||
article.availability = true if @supplier.shared_sync_method == 'all_available'
|
||||
article.availability = false if @supplier.shared_sync_method == 'all_unavailable'
|
||||
article.save or has_error=true
|
||||
end
|
||||
@new_articles.each {|a| a.save or has_error=true }
|
||||
|
||||
raise ActiveRecord::Rollback if has_error
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue