Rails 2.3.2 trying to render ERB instead of HAML

Posted by c00lryguy on Stack Overflow See other posts from Stack Overflow or by c00lryguy
Published on 2009-07-19T17:06:50Z Indexed on 2010/04/14 11:43 UTC
Read the original article Hit count: 381

Filed under:
|

Rails is suddenly trying to render ERB instead of Haml and I can't figure out why. I've created new rails projects, reinstalled Haml, and reinstalled Rails.

Here's exactly the steps I take when making my application (Rails 2.3.2):

  rails> rails test
  rails> cd test
  rails\test> haml --rails .
  rails\test> ruby script\generate model user email:string password:string
  rails\test> ruby script\generate controller users index
  rails\test> rake db:migrate

Here's what the UsersController looks like:

class UsersController < ApplicationController
  def index
    @users = User.all
  end
end

My routes:

ActionController::Routing::Routes.draw do |map|
  map.resources :users
end

I now create views\users\index.html.haml:

%table
  %th(style="text-align: left;")
    %h1 Users
  - for user in @users
    %tr
      %td= user.email
      %td= user.password

Annnd run the server... I navigate to localhost:3000\users and I get this error message:

Template is missing

Missing template users/index.erb in view path app/views

For some reason Rails is trying to find and render .erb files instead of .haml files. vendor\plugins\haml\init.rb exists, untouched.

I've reinstalled Haml (Pretty Penny) multiple times and still get the same results. I've also tried adding config.gem 'haml' to my environment.rb but this also doesn't work.

I can't figure out why suddenly rails will not render haml for me.

© Stack Overflow or respective owner

Related posts about haml

Related posts about ruby-on-rails