[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [myexperiment-hackers] Route issue with "aliased" models
From: |
David R Newman |
Subject: |
Re: [myexperiment-hackers] Route issue with "aliased" models |
Date: |
Wed, 07 Dec 2011 16:09:56 +0000 |
Thanks Finn. Dan and Don are at the research group xmas party and I
don't think I can do colo updates. So it will probably have to wait
until tomorrow. If you notice any other bugs or things that can be done
in a more Rails2 way, please do mention them and update trunk if you
know of an appropriate fix.
On Wed, 2011-12-07 at 16:01 +0000, Finn Bacall wrote:
> This is now done, and ready to go into trunk whenever, just let me know.
> I also discovered and fixed a bug that is present on the live site at
> the moment, wherein a stack error occurs if you try and "favourite" a file.
>
> -Finn
>
> On 02/12/11 10:34, Finn Bacall wrote:
> > I've decided to rewrite some code in my datasets branch to take
> > advantage of Rails 2's ability to automatically infer routes from a
> > given object (for example 'link_to(@object.name, @object')).
> >
> > However, it can't figure out what to do with instances of Blob and
> > Network as, the resources described in the routes file are named
> > "Files" and "Groups" respectively.
> >
> > To solve this, rather than having: "resources :files, :controller =>
> > :blobs..."
> > you can use: "resources :blobs, :as => :files..."
> >
> > which would maintain the same functionality/URL paths as the one
> > above, and Rails would know that its the route for the "Blob" model.
> >
> > This has the advantage of allowing things that deal with heterogeneous
> > sets of resources to be able to generate links to resources without
> > needing switch statements.
> >
> > The major issue is, all instances of "file_path(@file.id)" etc. would
> > have to be replaced with "blob_path(@file.id)". As far as I can tell,
> > there isn't a way to avoid this.
> >
> > I'd like to hear peoples' thoughts on this.
> >
> > -Finn
> >
>
>