On 19 August 2015 at 06:06, Pradeep Achuthan <[email protected]> wrote:
> I am building an expense tracker application and I am in middle of data
> modelling. I have a Users table. Each user will log his expenses with
> expense type and income with income type. So I need to know how can we set
> up associations for it.
> As per my understanding I have set it up as follows
>
>     User has_many :expenses, through: :transactions
>     User has_many :incomes, through: :transactions
>
>     Expense belongs_to :user
>
>     Income belongs_to :user
>
> Here I am not sure what the transaction would associate and also
> expene/income type.

What are the fields of expense and income?  The answer to that
determines whether you need a transactions table and what should be in
it.


Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLunScaHFvi%3Dgta7T-b8wZyH7PYUUCg_fVz8MhF9oksKfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to