Simon Welker wrote in post #1019149:
> Hello out there!
> I am developing an app that includes a simple forum system, and am
> using a nested resource there:
>
> resources :forums do
> resources :topics
> end
>
> So I get URLs like /forums/3/topics/2. Now I, for sure, also got a
> Post model, controller, etc., and I want this controller to redirect
> to the topic which was posted to, which will work fine with:
>
> redirect_to [@topic.forum, @topic]
>
> But I want to pass a params[:page] variable to use with the
> will_paginate gem, so it redirects to the right page of the new post,
> not just to the first page of the topic as of default. (I wrote a
> small helper method there to find out the right page for a post)
>
> So I tried this:
>
> redirect_to [@topic.forum, @topic], :page => find_topic_page(@post)
>
How about:
redirect_to( a_named_route(@topic.forum, @topic),
{ :page => find_topic_page(@post) }
)
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment