Skip to content
This repository

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

Closed
masterkain opened this Issue · 3 comments

2 participants

Claudio Poli Carlos Antonio da Silva
Claudio Poli

I have two views for the same controller/action: home/index.html.haml home/index.js.coffee
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 index.js.coffee.

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 151.64.233.122 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.

Gemfile:

source 'http://rubygems.org'

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'
end

gem 'jquery-rails'

Controller action:

def index
    # Just render, please
end

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

Carlos Antonio da Silva

@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.

Claudio Poli

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

Carlos Antonio da Silva

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.