small medium large xlarge

Generic-user-small
06 Jan 2012, 10:22
WangTuo (4 posts)

haml doesn’t work with rails 3.1. MissingTemplate (Missing template admin/index, application/index with {:handlers=>[:erb, :builder, :coffee], :formats=>[:html], :locale=>[:en, :en]}. we can see that :handlers don’t include :haml. gem haml (3.1.4) installed.

Anyone try that???

Thank you any way.

Samr_small_pragsmall
06 Jan 2012, 11:07
Sam Ruby (634 posts)

HAML works for me, using the instructions provided in the book, with Rails 3.1:

http://intertwingly.net/projects/AWDwR4/checkdepot-192-31/section-26.3.html

Generic-user-small
09 Jan 2012, 05:33
WangTuo (4 posts)

Hi, Sam. Can I see your Gemfile? Following is the gem I installed.

actionmailer (3.1.1)
actionpack (3.1.1)
activemodel (3.1.1)
activerecord (3.1.1)
activerecord-jdbc-adapter (1.2.1)
activerecord-jdbcmysql-adapter (1.2.1)
activeresource (3.1.1)
activesupport (3.1.1)
arel (2.2.1)
builder (3.0.0)
bundler (1.0.21 ruby)
coffee-rails (3.1.1)
coffee-script (2.2.0)
coffee-script-source (1.1.3)
erubis (2.7.0)
execjs (1.2.9)
haml (3.1.1)
hike (1.2.1)
i18n (0.6.0)
jdbc-mysql (5.1.13)
jquery-rails (1.0.16)
json (1.6.1)
mail (2.3.0)
mime-types (1.17.2)
multi_json (1.0.3)
mysql (2.8.1)
polyglot (0.3.3)
rack (1.3.5)
rack-cache (1.1)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.1.1)
railties (3.1.1)
rake (0.9.2.2, 0.9.2)
rdoc (3.11)
sass (3.1.10)
sass-rails (3.1.4)
sprockets (2.0.3)
sqlite3 (1.3.4)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)
uglifier (1.0.4)
will_paginate (3.0.2)

</code> I still get the same error about missing template.. Thank you.

Generic-user-small
09 Jan 2012, 05:31
WangTuo (4 posts)

When try index.html.erb, by url route: /admin. It’s ok. But if I replace index.html.erb with index.haml, then the miss template error happens. my index.html.erb file:

<h1>Welcome</h1>
It's <%= Time.now %>
We have <%= pluralize(@total_orders, "order") %>.

</code> my index.html.haml file:

%h1 Welcome
%p It's 
= Time.now
%p We have 
= pluraize @total_orders, "order"

</code> I think the problem is that handler only contain :erb, :builder, :coffee, no :haml, that means haml is not support.

Samr_small_pragsmall
12 Jan 2012, 02:49
Sam Ruby (634 posts)

Gemfile:

http://media.pragprog.com/titles/rails4/code/rails31/depot_v/Gemfile

The name of the view file should be index.html.haml:

http://media.pragprog.com/titles/rails4/code/rails31/depot_v/app/views/store/index.html.haml

Generic-user-small
18 Jan 2012, 02:24
WangTuo (4 posts)

I try both index.html.haml and index.haml. None of them worked. Maybe there is some version problem with my rails version(rails-3.1.1)

You must be logged in to comment