Hello people :) I'm bad in English, so i'll be short. It newbie question, I think) In my application I has users, which :has_many => posts. In routes.rb I can with ease create routes for posts like /:user_id/posts/..., but I wish to have something like /posts/:user_id/... instead. And use map.resources syntax to be one-liner, of course :) Can I possibly do that? Thank in advance!
on 2009-04-06 15:21
on 2009-04-06 16:19
Hi there, I have article display set-up on my side as follows: map.article 'article/show/:permalink', :controller => 'article', :action => 'show' So you might be looking for something like this: map.posts '/posts/:user_id', :controller => 'posts', :action =< 'show' HTH, Schalk
on 2009-04-06 16:28
On 6 Ð°Ð¿Ñ€, 16:18, Schalk N. <email@example.com> wrote: > Schalk > So for scaffold-generated resourse I have to create seven routes :(
on 2009-04-07 03:04
And url-generation for this routes a pretty ugly in views: instead of show_post_path I write now show_post_url(:user_id => post.author_id, :post_id => post.id) Maybe some another way?
on 2009-04-07 03:22
form_for(@post) breaks too.