[LRUG] REST and Associations

David A. Black dblack at wobblini.net
Tue Feb 27 15:22:35 PST 2007


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.


David

-- 
Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black)
   (See what readers are saying!  http://www.rubypal.com/r4rrevs.pdf)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)



More information about the Chat mailing list