Created
December 16, 2011 13:48
-
-
Save arnklint/1486109 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /app/models/customer_rep.rb | |
class CustomerRep | |
attr_reader :name, :customer_id | |
def initialize( obj ) | |
@name = obj.name | |
@customer_id = obj.id | |
end | |
end | |
# /app/models/customer.rb | |
class Customer < AR | |
# jadajadajada | |
after_save :save_fortnox | |
protected | |
def save_fortnox | |
FortnoxAPI::Customer.update( CustomerRep.new(self) ) | |
end | |
end | |
attributes.merge(:root => :invoice)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
API::Fortnox.update( props )