rails, rest, render different action with responds to

Posted by Sam on Stack Overflow See other posts from Stack Overflow or by Sam
Published on 2010-04-17T03:30:41Z Indexed on 2010/04/17 3:33 UTC
Read the original article Hit count: 279

Filed under:
|

Maybe my logic is not restful or know if this is how you would do it but this is what I am trying to do.

I'm getting a category inside a category controller and then once I get that category I want to return to an index page in a different controller but keep that @category and the Category.busineses.

Before rest I would have just done this:

render :controller => "businesses"

and it would have rendered the view of the index action in that controller.

now in my respond_to block I have this

   format.html {redirect_to(business_path)} # index.html.erb
   format.xml  { render :xml => @businesses }

but of course with a render it looses the instance variable and starts with a new action.

So what I want to do is render the action instead of redirecting to that action. is this possible?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about rest