mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-09 01:14:23 -05:00
Update qbo_item.rb
Formatting
This commit is contained in:
@@ -21,15 +21,15 @@ class QboItem < ActiveRecord::Base
|
|||||||
def self.update_all
|
def self.update_all
|
||||||
items = get_base.service.find_by(:type, "Service")
|
items = get_base.service.find_by(:type, "Service")
|
||||||
|
|
||||||
transaction do
|
transaction do
|
||||||
# Update the item table
|
# Update the item table
|
||||||
items.each { |item|
|
items.each { |item|
|
||||||
qbo_item = QboItem.find_or_create_by(id: item.id)
|
qbo_item = QboItem.find_or_create_by(id: item.id)
|
||||||
qbo_item.name = item.name
|
qbo_item.name = item.name
|
||||||
qbo_item.id = item.id
|
qbo_item.id = item.id
|
||||||
qbo_item.save!
|
qbo_item.save!
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
#remove deleted items
|
#remove deleted items
|
||||||
where.not(items.map(&:id)).destroy_all
|
where.not(items.map(&:id)).destroy_all
|
||||||
|
|||||||
Reference in New Issue
Block a user