Tony, On Wed, Dec 3, 2008 at 9:33 PM, Tony Mann <[EMAIL PROTECTED]> wrote: > Two questions: > > * Have you tried using url(:articles_comments_ratings, 1)? I have not been > able to find the repro steps yet, but sometimes using the named route works > while using the resource route fails.
Nope I haven't tried the url helper, because I'm building the redirect calls dynamically inside my http://github.com/snusnu/merb_resource_controller/commits/ plugin and it's much easier to generate the rigth "path" using resource compared to url. Everything works fine as long as i don't nest my models inside modules! The plugin already handles arbitrarily deep nesting of resources, now I want to teach it how to behave when the models are nested inside modules. > > * To show or edit a rating, you should not need the nested route if the > ratings ID is unique. In this case, you could add the unnested ratings to > your route and use this instead. Actually this code snippet comes from my tests for the above mentioned plugin. It's a totally constructed example actually. Basically, what I'm trying to do, is make the plugin work with models that are nested inside other modules. > > ..tony.. > > On Wed, Dec 3, 2008 at 11:58 AM, Martin Gamsjaeger <[EMAIL PROTECTED]> > wrote: >> >> Hey all, >> >> I have my routes setup like so: >> >> resources :articles do >> resources :comments do >> resources :ratings, :controller => "community/ratings" >> end >> end >> >> My ratings model is defined like >> >> module Community >> >> class Rating >> >> include DataMapper::Resource >> >> property :id, Serial >> property :comment_id, Integer >> property :rate, Integer >> >> belongs_to :comment >> >> end >> >> end >> >> When I POST to /articles/1/comments/1/ratings it works fine, but then, >> when I want to redirect to >> >> /articles/1/comments/1/ratings/1 >> >> using >> >> redirect @article, @comment, @rating >> >> and I get the following error: >> >> ~ Resource route not found: [#<Article id=1 title="yo" body="snusnu" >> editor_id=nil>, #<Comment id=1 article_id=1 body="wassup">, >> #<Community::Rating id=1 comment_id=1 rate=1>] - >> (Merb::Router::GenerationError) >> >> If I don't nest the rating model, everything works fine! >> >> Any ideas? >> >> cheers >> snusnu >> >> > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "merb" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/merb?hl=en -~----------~----~----~----~------~----~------~--~---
