Re: How to setup multiple HABTM relationships between two tables

2011-01-13 Thread Jeremy Burns | Class Outfit
You could consider adding a new column to your joining table that contains a tinyint. By default the value of that field is 0 (which indicates wants) but changes to 1 when he owns it. This assumes that someone can no longer 'want' something when they already 'own' it. Jeremy Burns Class Outfit

Re: How to setup multiple HABTM relationships between two tables

2011-01-13 Thread mklappen
Thanks for replies... I added a two boolean columns to join table for owns and wants Thanks again!! On Jan 13, 3:13 am, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: You could consider adding a new column to your joining table that contains a tinyint. By default the value of

Re: How to setup multiple HABTM relationships between two tables

2011-01-13 Thread cricket
On Thu, Jan 13, 2011 at 3:55 PM, mklappen mklap...@gmail.com wrote: Thanks for replies... I added a two boolean columns to join table for owns and wants You might be interested in modelizing the join table like this: http://book.cakephp.org/view/1650/hasMany-through-The-Join-Model Also, as

How to setup multiple HABTM relationships between two tables

2011-01-12 Thread mklappen
Hi All I'm having a little difficulty conceptualizing the relationships when setting up a database/models, for a app I'm starting to develop. If I'm creating a basic inventory management application I have the following: Table Name | Columns users | id, user_name, email, etc... items | id, name,

Re: How to setup multiple HABTM relationships between two tables

2011-01-12 Thread John Andersen
It all depends! What is the requirement for owning items? Can a user own more than one of the same item? What is the requirement for wanting items? Can a user want more than one of the same item? Can a want record expire - ie. the user wants the item, but only if the user can get it within X

Re: How to setup multiple HABTM relationships between two tables

2011-01-12 Thread Zaky Katalan-Ezra
If you go with the status columns you need two boolean columns one for own and one for want, its a possible solution. If you want to use two table you can create users_want and users_own. The relation for each table should looks like it would be for items_users. The reason to prefer one