Skip to content

3.1.1, html view has precedence over a js one in production #3433

masterkain opened this Issue Oct 25, 2011 · 3 comments

2 participants


I have two views for the same controller/action: home/index.html.haml home/
I'm using the rails jquery adapter (see Gemfile below).

Then I make a normal ajax call (with data-remote=true) and in development mode rails renders the right view

In production mode however index.html.haml is always being called instead of the js one.

Assets are precompiled and I have no JS errors.
Browsers sends that right data and headers.

Rails itself says it's processing JS:

Started GET "/?page=2" for at 2011-10-25 16:26:45 +0000
  Processing by HomeController#index as JS
  Parameters: {"page"=>"2"}
Rendered home/index.html.haml (172.3ms)
Completed 200 OK in 178ms (Views: 177.3ms)

But as you can see the wrong view is being rendered.


source ''

gem 'rails', '3.1.1'

group :assets do
  gem 'sass-rails',   '~> 3.1.4'
  gem 'coffee-rails', '~> 3.1.1'
  gem 'uglifier', '>= 1.0.3'

gem 'jquery-rails'

Controller action:

def index
    # Just render, please

I also tried with the classic respond_to/respond_with to no avail. All works in development but not in production.

Ruby on Rails member

@masterkain could you check if this issue still persists on latest 3.2.x versions? There have been some changes on rendering and formats since 3.1. Please try checking and reporting back so we can verify if it's still an issue or if this could be closed. Thanks.


My project is on Rails 3.2.3 now and I don't experience particular issues. Thanks.

@masterkain masterkain closed this Mar 31, 2012
Ruby on Rails member

Great, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.