Можно сделать так
в layout пишим
<%= yield :after_js %>
А на странице подключать:
<% content_for :after_js do %>
<%= javascript_include_tag 'pages/users/index' %>
<% end %>
Так же забыть исключить файл из application.js
И добавить в config/initializers/assets.rb
Rails.application.config.assets.precompile += ['pages/users/index.js']