Question

Rails 4 - I have an action that handles routes like www.site.com/catalog/shoes/sport/ABC123 for product and www.site.com/catalog/shoes/sport for category The problem is I have to display some seo-paid links (not my choise, I just have to) in format www.site.com/href, and that link must me handled as some product category. That's not the only case - in future, there might be some other "short"-links, that are pointing to other parts of my site

When I used Symfony, I could just write $this->forward('controller', 'action') and get another controller's output while saving short route, but in Rails I see only redirect_to, and it does not preserve short url?

Assuming I have a route get ':href' => 'index#simple', as: :simple, how do I forward execution to another controller (or just call controller's method?), preserving original route? - In "rails way", of course

Thank you

Was it helpful?

Solution

You can just use 'redirect_to controller_action_path' / redirect_to '/controller/action' from your controller action.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top