Rails: Get the controller and action of the current request
ruby-on-rails, ruby-on-rails-4
Solution
It was turbolinks. Turn off turbolinks and you're good to go. http://blog.steveklabnik.com/posts/2013-06-25-removing-turbolinks-from-rails-4
Problem
In my Rails application, I use `<html id=<%= params[:controller] + "_" + params[:action] %>` in views/layouts/application.html.erb. The strange thing is, the values of `params[:controller]` and `params[:action]` always lag by 1 request if it is anywhere above the opening `<body>` tag. So if I'm on `users/1`, but I came from `users/`, the values above opening `<body>` will be controller: "users" and action: "index". Shouldn't `params[:action]` be "show"?. Then if I refresh the page, it 'catches up' and correctly has controller: "users" and action: "show". Why is this happening? How can I get the current requests controller and action? Will these params not be updated until the first time `yield` is called?