Haml crashes on valid RHTML

1 view
Skip to first unread message

Jeff

unread,
Jan 23, 2007, 12:15:19 PM1/23/07
to Haml
It appears that Haml is crashing on a valid .rhtml template. In this
case there is no corresponding .haml template. I'm running Rails
1.2.1 and Haml 1.4. Details follow.

-- Jeff

ActionView::TemplateError (You have a nil object when you didn't expect
it!
The error occurred while evaluating nil.buffer) on line #8 of
app/views/sites/new.rhtml:
5: <%= error_messages_for :site %>
6:
7: <div class="horz">
8: <% form_for(:site, :url => member_sites_path(@member)) do |f| %>
9: <h3>Site Name</h3>
10: Your site name uniquely identifies your space on
acklife.com.
11: If your site name is <strong>jane</strong>, people will
find your site at


#{RAILS_ROOT}/vendor/plugins/haml/lib/haml/helpers/action_view_mods.rb:35:in
`concat'

#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb:126:in
`form_for'
#{RAILS_ROOT}/app/views/sites/new.rhtml:8:in
`_run_rhtml_47app47views47sites47new46rhtml'

#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:326:in
`send'

#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:326:in
`compile_and_render_template'

#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:301:in
`render_template_old'
#{RAILS_ROOT}/vendor/plugins/haml/lib/haml/template.rb:135:in
`render_template'

#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:260:in
`haml_old_render_file'
#{RAILS_ROOT}/vendor/plugins/haml/lib/haml/template.rb:120:in
`render_file'

#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:806:in
`render_file'

#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:711:in
`render_with_no_layout'

#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/layout.rb:247:in
`render_without_benchmark'

#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:50:in
`render'

Message has been deleted

Nathan Weizenbaum

unread,
Jan 24, 2007, 12:35:39 PM1/24/07
to ha...@googlegroups.com
Fixed in trunk. I'll do it in stable this afternoon.

- Nathan

Jeffrey Richardson

unread,
Jan 25, 2007, 9:09:31 PM1/25/07
to Haml
I didn't notice a change in stable, so I just pulled down the trunk.
I'm still crashing, as below.

-- Jeff

ActionView::TemplateError (You have a nil object when you didn't expect
it!

The error occurred while evaluating nil.buffer) on line #13 of
app/views/members/edit.rhtml:
10: <%= error_messages_for :member %>
11:
12: <div class='horz'>
13: <% form_for(:user, @member, :url => member_path(@member), :html
=> { :method => :put }) do |f| %>
14:
15: <h3>For your Security</h3>
16: To enable changes below, please enter your current
password.


#{RAILS_ROOT}/vendor/plugins/haml/lib/haml/helpers/action_view_mods.rb:36:in
`concat'

#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb:126:in
`form_for'

#{RAILS_ROOT}/app/views/members/edit.rhtml:13:in
`_run_rhtml_47app47views47members47edit46rhtml'

#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:326:in
`send'

#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:326:in
`compile_and_render_template'

#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:301:in
`render_template_old'

#{RAILS_ROOT}/vendor/plugins/haml/lib/haml/template.rb:125:in
`render_template'

#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:260:in
`haml_old_render_file'

#{RAILS_ROOT}/vendor/plugins/haml/lib/haml/template.rb:110:in

Nathan Weizenbaum

unread,
Jan 25, 2007, 9:19:42 PM1/25/07
to ha...@googlegroups.com
Could you post the entire RHTML file, or even better, try to find the
minimal RHTML that causes it to crash?

- Nathan

Jeffrey Richardson

unread,
Jan 25, 2007, 10:49:31 PM1/25/07
to Haml
It appears that the crash is occurs only when mixing a haml partial and
a rhtml form_for tag. Here is the minimal code to cause the crash:

<%= render :partial => 'who' %>


<% form_for(:user, @member, :url => member_path(@member), :html => {
:method => :put }) do |f| %>

<% end %>

If I put fields into the form above the crash still occurs. If I
include the partial above, but exclude the form: no crash. If I
include only the form, w/o the partial: no crash.

The partial 'who', referenced above, is haml. It it two lines long:

#who
%h2= "You are logged in as #{h @member.email}"

-- Jeff

Nathan Weizenbaum

unread,
Jan 25, 2007, 11:23:58 PM1/25/07
to ha...@googlegroups.com
Alright, now it should /really/ be fixed. It'll be in stable in a bit, too.

- Nathan

Reply all
Reply to author
Forward
0 new messages