mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-09 01:14:23 -05:00
Update customer.rb
This commit is contained in:
@@ -84,8 +84,7 @@ class Customer < ActiveRecord::Base
|
|||||||
|
|
||||||
# updates the customer's notes in QBO
|
# updates the customer's notes in QBO
|
||||||
def notes=(s)
|
def notes=(s)
|
||||||
customer = get_customer(self.id)
|
@details.notes = s if @details
|
||||||
customer.notes = s
|
|
||||||
push
|
push
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -121,8 +120,26 @@ class Customer < ActiveRecord::Base
|
|||||||
where.not(customers.map(&:id)).destroy_all
|
where.not(customers.map(&:id)).destroy_all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Magic Method
|
||||||
|
def method_missing(name, *arguments)
|
||||||
|
value = arguments[0]
|
||||||
|
name = name.to_s
|
||||||
|
|
||||||
|
# if the method's name ends with '='
|
||||||
|
if name[-1, 1] == "="
|
||||||
|
method_name = name[0..-2]
|
||||||
|
puts "Setting '#{method_name}' to '#{value}'"
|
||||||
|
@details[method_name] = value
|
||||||
|
push
|
||||||
|
else
|
||||||
|
puts "Getting '#{name}'"
|
||||||
|
@details[name]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
# Push the updates
|
||||||
def push
|
def push
|
||||||
begin
|
begin
|
||||||
get_base.update(@details)
|
get_base.update(@details)
|
||||||
|
|||||||
Reference in New Issue
Block a user