I have 2 edit buttons in 2 different pages. One is working perfectly opening a modal to edit, the other one is redirecting to a page that doesn't exist. How can I fix that? I am using ruby on rails 5.2.6 and bootstrap 5.2.
Button that is working opening a modal:
<%= link_to icon('fas', 'pen'), edit_task_path(task, redirect_to: tasks_url(view: params[:view])), title: 'Editar', remote: true, class: "px-1" %>
I tryind to add a byebug before this button and got this results:
(byebug) tasks_url(view: params[:view]) "http://localhost:3000/tasks?view=table" (byebug) params <ActionController::Parameters {"group_by"=>"task_category_html", "view"=>"table", "controller"=>"tasks", "action"=>"index", "default_date"=>Thu, 07 Dec 2023} permitted: false>
Button that is redirecting to a different page:
<%= link_to edit_task_path(task, redirect_to: tasks_url(view: params[:view])), remote: true, class: 'btn btn-outline-primary' %>
<span class="fas fa-pen" aria-hidden="true"></span> Editar
<% end %>
I tried to add a byebug before the button and got this results:
(byebug) tasks_url(view: params[:view])
"http://localhost:3000/tasks?view=table"
(byebug) params
<ActionController::Parameters {"group_by"=>"task_category_html", "view"=>"table", "controller"=>"tasks", "action"=>"index", "default_date"=>Thu, 07 Dec 2023} permitted: false>
You have missed the
dokeyword in the link_to statement, Please try this