Re: [Rails] Doubts on what association to choose

2014-09-23 Thread Colin Law
On 23 September 2014 09:20, Diego Dillenburg Bueno wrote: > I think I know what it is now, but no clue why it happens. > It won't work whenever I open a html tag before <%= form_for @billing do > |billing| %> and close it before <%= f.fields_for :debts do |builder| %> Do you mean you have ?

Re: [Rails] Doubts on what association to choose

2014-09-23 Thread Diego Dillenburg Bueno
I think I know what it is now, but no clue why it happens. It won't work whenever I open a html tag before <%= form_for @billing do |billing| %> and close it before <%= f.fields_for :debts do |builder| %> Anyone ever been through this or something similar? It must be some failure at the applicatio

Re: [Rails] Doubts on what association to choose

2014-09-23 Thread Diego Dillenburg Bueno
Sorry, little typo there. corret is: http://www.github.com/diegodillenburg/codero I typed my name wrong hahaha. @Collin, yeh I have debugparams in my views, which I learned on railstutorial, that's how I somehow identified my problem. Anyway, I think I've managed to find the problem but still tryin

Re: [Rails] Doubts on what association to choose

2014-09-22 Thread Colin Law
On 23 September 2014 07:38, Colin Law wrote: > On 23 September 2014 06:13, Diego Dillenburg Bueno > wrote: >> Thank you very much for the attention, guys! >> I think I have nailed the association modelling. And as of the debt >> relationship. It would be like: Someone pay for a bill(creditor) for

Re: [Rails] Doubts on what association to choose

2014-09-22 Thread Colin Law
On 23 September 2014 06:13, Diego Dillenburg Bueno wrote: > Thank you very much for the attention, guys! > I think I have nailed the association modelling. And as of the debt > relationship. It would be like: Someone pay for a bill(creditor) for many > other people(those are debtors), that's why I

Re: [Rails] Doubts on what association to choose

2014-09-22 Thread Vivek Sampara
Diego , Is the link working ? im getting a 404 error from github that repo does not exist. Regards Vivek On Tue, Sep 23, 2014 at 10:43 AM, Diego Dillenburg Bueno < diegodillenb...@gmail.com> wrote: > Thank you very much for the attention, guys! > I think I have nailed the association modelling.

Re: [Rails] Doubts on what association to choose

2014-09-22 Thread Diego Dillenburg Bueno
Thank you very much for the attention, guys! I think I have nailed the association modelling. And as of the debt relationship. It would be like: Someone pay for a bill(creditor) for many other people(those are debtors), that's why I need to have 0, 1 or multiple debtors in one billing. That's where

Re: [Rails] Doubts on what association to choose

2014-09-22 Thread Jason Fleetwood-Boldt
Diego, You actually have a very good question here. I don't quite see all the foreign keys here, and I only grok 75% of your specific data model, so I will answer your question generally and give you some options rather than specifically tell you how to do it. You probably read that the rails

Re: [Rails] Doubts on what association to choose

2014-09-21 Thread Timothy Mukaibo
Hi Diego, You're correct when you say you can add the logic for a has_many / belongs_to (which is a one to many relationship), but as far as I'm aware, you need a has_many :through for adding logic to a many-to-many relationship. Good luck with the internship! Timothy. On 22 September 2014 12:37

Re: [Rails] Doubts on what association to choose

2014-09-21 Thread Diego Dillenburg Bueno
Won't I be able to add the logic I need for debts using has_many belongs_to? Basically all that I would need is to gather which debts I(as the user) have and be able to(in future) toggle their 'paid/unpaid' status. Or would it be better to have a relationship table? via has_many through? As of the

Re: [Rails] Doubts on what association to choose

2014-09-21 Thread Timothy Mukaibo
Assuming a single creditor and multiple debtors for a single billing, you will need a one to one relationship for the creditor -> billing (belongs_to on the billing, as you have done), but a many to many relationship for debts -> users. Generally, it's better to implement the many-to-many as a has

[Rails] Doubts on what association to choose

2014-09-20 Thread Diego Dillenburg Bueno
Hello everyone, I'm a beginner Rails developer and right now am building a sample project to show off at some job apply. The app is rather simple, I guess, but I have come to some doubts on what associations to chose and why. Basically a User can create a bill(being its creditor) and the billing