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?
Should i just replace the respond_to with render :controller => ?
I think what you are trying to do (if I understand it correctly) would be best achieved using nested resources. If there are businesses separated into categories, and you want to display a listing of all businesses in a specific category, you could set up your application like this:
Models
Routes
Controller
Then simply access the list of a category’s businesses like this:
/category/1/businesses