Why doesn't JavaScript work when I redirect from Rails Controller?
How do I modify it so that JavaScript works?
sessions_controller.rb (Redirect by Create action)
class SessionsController < ApplicationController
...
def create
...
redirect_to root_path
end
...
end
rails routes
% rails routes | head
Prefix Verb URI Pattern Controller#Action
root GET / shops#index
shops_controller.rb
class ShopsController < ApplicationController
def index
...
end
...
end
index.html.erb
...
<%= render partial: "shops_sort_by_distance", locals: {area: area} %>
...
index.js (Not executed)
window.onload = () => {
...
func();
};