Moving rails app to production and running into the routing issues. I’ve read this answer:
What is the replacement for ActionController::Base.relative_url_root?
but am still having problems understanding the complete solution, and also, how to continue to develop without caring where the app gets placed.
I am running the app at: http://dev.mycompany.com:8081/myapp/
So I put this in production.rb:
config.action_controller.relative_url_root = “/myapp”
I put this in routes:
scope "/myapp" do
root :to => 'application#index'
match 'login/index' => 'logins#index', :as => 'logins_index'
end
In my form tag, I have:
<form class="loginForm" name="loginForm" id="loginForm" action="<%= url_for('/login') %>" method="post">
I thought that everything would magically work, but in fact I needed to put
action="<%= url_for('/myapp/login') %>"
To get it to work. Is this expected? I don’t want to have to worry about where my app is getting placed for production, but this solution requires it to be in my code. thanks
You’ve defined helper
logins_index_xxx(wherexxxcan bepathorurl) but you don’t use it. Why? Try this: