mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 17:04:23 -05:00
Update customer.rb
This commit is contained in:
@@ -20,7 +20,7 @@ class Customer < ActiveRecord::Base
|
|||||||
attr_accessible :name
|
attr_accessible :name
|
||||||
validates_presence_of :id, :name
|
validates_presence_of :id, :name
|
||||||
|
|
||||||
after_find :get_details, :unless
|
after_initialize :get_details
|
||||||
|
|
||||||
self.primary_key = :id
|
self.primary_key = :id
|
||||||
|
|
||||||
@@ -137,11 +137,9 @@ class Customer < ActiveRecord::Base
|
|||||||
# if the method's name ends with '='
|
# if the method's name ends with '='
|
||||||
if name[-1, 1] == "="
|
if name[-1, 1] == "="
|
||||||
method_name = name[0..-2]
|
method_name = name[0..-2]
|
||||||
puts "Setting '#{method_name}' to '#{value}'"
|
|
||||||
@details[method_name] = value
|
@details[method_name] = value
|
||||||
push
|
push
|
||||||
else
|
else
|
||||||
puts "Getting '#{name}'"
|
|
||||||
begin
|
begin
|
||||||
return @details[name]
|
return @details[name]
|
||||||
rescue
|
rescue
|
||||||
@@ -172,12 +170,9 @@ class Customer < ActiveRecord::Base
|
|||||||
|
|
||||||
# init details
|
# init details
|
||||||
def get_details
|
def get_details
|
||||||
t= Thread.new {
|
|
||||||
if self.id
|
if self.id
|
||||||
@details = get_customer(self.id)
|
@details = get_customer(self.id)
|
||||||
end
|
end
|
||||||
}
|
|
||||||
t.join
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# update's the customers name if updated
|
# update's the customers name if updated
|
||||||
|
|||||||
Reference in New Issue
Block a user