[OpenLayers-Dev] Finding A Specific Old Version of a Way
Tom Hughes
tom at compton.nu
Tue May 13 03:18:32 EDT 2008
In message <20080513065608.GA15589 at metacarta.com>
Christopher Schmidt <crschmidt at metacarta.com> wrote:
> Is there a way to select a specific version of an old way?
Several ;-) As things stand you could do:
OldWay.find(:first, :conditions => ["id = ? and version = ?", id, version])
but as I said the other day, it would be better to declare the
primary key for that model properly now we have the composite
keys plugin. So add:
set_primary_keys :id, :version
to the top of the model, then you can do:
OldWay.find(id, version)
> In Django, I'd do something akin to:
>
> old_way = OldWay.objects.get(id=23931312, version=1)
>
> I don't know what the Rails equivilant is. Anyone know?
>
> (Is there a tutorial I should read on Rails to answer this?)
Lots probably, but this is an unusual case as it involves a composite
primary key which rails doesn't natively support...
Tom
--
Tom Hughes (tom at compton.nu)
http://www.compton.nu/
More information about the Dev
mailing list