lundi 16 novembre 2020

Ruby on Rails Write a redirect for a dynamic URL to a static URL

Is there a simple way to write a ruby if statement to redirect a dynamic page to a static page?

I’m writing this in my pages controller where the site pages are generated. This is what I’m attempting to do.

If “/index/page1” redirect_to “page2” return end

This redirects all the pages created in the pages controller to “page2”. I know the syntax is incorrect. I need help in writing out the correct way to test for the first condition.

Any help is appreciated. Thank you!

Aucun commentaire:

Enregistrer un commentaire