[Nitro] [PATCH] Allow multiple joins_many style relationships between two classes (and relevent test case)

Rob Pitt rob at motionpath.com
Fri Feb 17 08:44:33 EST 2006


Typical me jumping the gun :)

This patch currently does not work with PostgreSQL store, I think it
should work with the others as they do not directly reference the
modified function. I am fixing it so PostgreSQL works properly with it
now.

(We needed this behaviour in a hurry... as usual less haste, more speed
would have been prudent).

On Fri, 2006-02-17 at 13:39 +0000, Rob Pitt wrote:
> I have not tested this with anything but SQLite store either, I will do
> PostgreSQL now and make appropriate changes (and a migration script so
> you can seamlessly upgrade old projects to use this new method without
> losing data).
> 
> I hope you all agree this is a good idea and it would be very cool if it
> doesn't work with your favoured store of choice (MySQL) if you let me
> know since I only have PostgreSQL and SQLite at the moment to play with.
> 
> On Fri, 2006-02-17 at 13:20 +0000, Rob Pitt wrote:
> > WARNING: This patch causes join tables to be created with different
> > names and will require you to manually copy join table data into newly
> > named tables if applied to a project you are already using.
> > 
> > Why would I make a patch that requires this? Not having this requirement
> > (i.e. doing it in an automated fashion) would be fairly complicated and
> > a big drain on CPU.
> > 
> > This patch still needs to be implemented at some point because it
> > enables a desirable behaviour, and we are at 0.2 so we should make
> > changes with big impacts like this now rather than later.
> > 
> > This is a very minor modification so that a model like this behaves as
> > it should:
> > 
> > Class Article
> >   property :title, String
> > 
> >   joins_many :first_join, Category
> >   joins_many :second_join, Category
> >   joins_many Category
> > 
> >   def initialize(title)
> >     @title = title
> >   end
> > end
> > 
> > Without this patch, items you push into .first_join are visible
> > in .second_join and the .categories join (all other combinations of this
> > are also true).
> > 
> > This is wrong, and this patch corrects this.
> > _______________________________________________
> > Nitro-general mailing list
> > Nitro-general at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/nitro-general
> 
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general




More information about the Nitro-general mailing list