This project is archived and is in readonly mode.

#4429 ✓resolved
VirtualFunction

Templates that use with_options...

Reported by VirtualFunction | April 17th, 2010 @ 04:04 PM | in 3.0.2

If I do something like:

= form_for some_object do |form|
  - form.with_options :class => 'text' do |input|
    = input.text_field :description

Under production mode in Rails 3.0 (trunk/beta3, with Ruby 1.9.2 x64 trunk) will output the text_field twice. This doesn't happen in development mode.

Admittedly this is in HAML, but pretty certain this will happen in ERB too, as I guess this is to do with fixing helpers like form_for and form_tag that output text within a do block as they previously needed to use '-' instead of '=' while using concat behind the scenes.

The use of the '-' notation in templates shouldn't output anything is my take (exception being form_for, form_tag etc purely for some level of backward compatibility with Ruby 2.x)

Oddly enough, this happens with the with_options method, but I don't seem to notice it with loops such as for statements or Array#each calls

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages