Ruby on Rails Thursday, August 20, 2015

Thanks Colin and Walter for contribution.... Liz

On Wednesday, August 19, 2015 at 11:28:38 AM UTC-4, Elizabeth McGurty wrote:
Pradeep, following pertains to more advanced folks here.  I thought that demonstrating a good solution would be easy, but I am encountering LocalJumpError: no block given (yield) on transaction_id... I created a transaction table, and referenced it from User has_many.  Folks, what the problem there?
Liz



On Wednesday, August 19, 2015 at 1:06:46 AM UTC-4, Pradeep Achuthan 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.

Any suggestions/insights would be great.

--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/bbccdff9-521e-46c4-9e8b-bc250e62405a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment