Change URL of the page if certain conditions are met


I want to change the URL of the page when a certain condition is met after form submission.

Imagine I have the following action in Rails controller

if condition == true
 redirect_to destination_path
 respond_to do |format|
            format.html { render partial: 'question', locals: { q: @question } }

so if the redirect_to get executed I want to change the URL, otherwise the URL will stay the same

how can I do that?

the issue you’re describing has a solution here

Thank you for your help, the solution worked

1 Like