[LRUG] REST and Associations

Piers Cawley pdcawley at bofh.org.uk
Wed Feb 28 00:33:40 PST 2007


"David A. Black" <dblack at wobblini.net> writes:

> HI --
>
> On 2/27/07, Piers Cawley <pdcawley at bofh.org.uk> wrote:
>
>> The problem I have with the current routing approach is that you have
>> to know too much to generate them. If I've got things set up so that
>> (for instance) comments are nested within articles, then I don't want
>> to have to call 'comment_url comment.article, comment'.
>
> You might find my inferred_routes plugin of interest; it's available at
> http://www.risleydale.net/svn/inferred_routes/tags/0.1.1
>
> One fix has been submitted that I haven't applied yet (involving
> CamelCase model names), but in general the idea is that it enables you
> to do:
>
>   comment_url(comment)
>
> and it infers comment.article for the missing first argument.

Will do. You might like to take a peek at
http://www.bofh.org.uk/articles/2007/01/25/initial-release-of-acts_as_resource,
which aims to do a similar thing.

-- 
Piers Cawley <pdcawley at bofh.org.uk>
http://www.bofh.org.uk/



More information about the Chat mailing list