Created
July 30, 2009 15:31
-
-
Save hakanensari/158742 to your computer and use it in GitHub Desktop.
Modeling bookkeeping app in Rails
This file contains 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
class Account < ActiveRecord::Base | |
acts_as_tree | |
belongs_to :asset_type | |
has_many :transactions | |
end | |
class AssetType < ActiveRecord::Base | |
has_many :accounts | |
end | |
class Transaction < ActiveRecord::Base | |
belongs_to :account | |
has_many :transactionships | |
has_many :matches, | |
:through => :transactionships, | |
:after_add => :add_inverse, | |
:after_remove => :remove_inverse | |
end | |
class Transactionship < ActiveRecord::Base | |
belongs_to :transaction | |
belongs_to :match, :class_name => "Transaction", :foreign_key => "match_id" | |
end | |
class Person < ActiveRecord::Base | |
belongs_to :person_type | |
end | |
class PersonType < ActiveRecord::Base | |
has_many :people | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment