How to model this the best

Hello,

Im planning a accounting app which I want to build with Rails.

First we have Assets/Liabiluties/Profit/Losss hard coded somewhere

Now the user has to make these steps to make financial accounts.

1) Now the user have to make Categories like sales costs.

     The relation to Assests/Liabities/Profit/Losss schould be many-to-many because for example Assests could have more then 1 Category but a category can have one of these Assests/Liabiliities/Profit/Loss

2) Now the user can make Acccounts like travelling_costs

     This one has a many-to-many relation with Category because a Category can contains more then 1 Account but a Account can belong to 1 Category.

Can I put them all in models or is there a better way to make this work ?

Roelof

Accounting is an interesting topic. I'm not an accountant but I think you
could find some inspiration in beancount (http://furius.ca/beancount/). It
has great documentation. See
https://docs.google.com/document/d/1N7HDXuNWgLG2PqFS4Kkgv5LzAAtU6c97UVNT7tdTIjA/edit#
.

I'm not sure whether this will help but you could have two models: Account
and Transaction. Accounts would form 5 trees with roots names: Assets,
Liabilities, Income, Expenses and Equity. Transactions would describe which
accounts they affect. You could have a structure of accounts like:

Expenses
  Client Meetings
    Meeting with X
      Travel Expenses

You could then total all transactions that affect the Travel Expenses
account. What do you think?

···

--
Greg Navis
I help small tech companies to scale Heroku-hosted Rails apps.
Free, biweekly scalability newsletter for SaaS CEOs
<http://www.gregnavis.com/newsletter/>