mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-09 01:14:23 -05:00
Fixed Models & Migrations for setting custom IDs
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
class QboItem < ActiveRecord::Base
|
||||
unloadable
|
||||
attr_accessible :name
|
||||
validates_presence_of :id, :name
|
||||
|
||||
def self.update_all
|
||||
qbo = Qbo.first
|
||||
@@ -20,6 +21,7 @@ class QboItem < ActiveRecord::Base
|
||||
service.all.each { |item|
|
||||
qbo_item = QboItem.find_or_create_by(id: item.id)
|
||||
qbo_item.name = item.name
|
||||
qbo_item.id = item.id
|
||||
qbo_item.save!
|
||||
}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user