This project is archived and is in readonly mode.
content_tag_for should behave like content_tag
Reported by Tom Lea | August 20th, 2008 @ 05:36 PM | in 2.x
The attached patch allows content_tag_for
to be used in all cases where content_tag
should work.
As it stands calling content_tag_for
in a helper, with a block ala...
def voodoo_summary(voodoo)
div_for(voodoo) do
h(voodoo.name) + " has " +
pluralise(voodoo.spells.count, "spells") +
link_to("[more details on #{voodoo.name}]", voodoo)
end
end
When this is called from the erb template...
<% @spell_book.voodoo.each do |voodoo| %>
<%= voodoo_summary(voodoo) %>
<% end %>
We end up getting multiple renders and worse.
Attached patch makes content_tag_for
use content_tag in a DRYer way... using it's code to prevent this.
Test included for good luck.
Comments and changes to this ticket
-
Tom Lea August 26th, 2008 @ 11:14 AM
- no changes were found...
-
Tom Lea August 26th, 2008 @ 11:14 AM
Posted updated patch, minor faux pas, modifying arguments in-pace is bad.
-
Michael Koziarski August 29th, 2008 @ 08:43 AM
- Assigned user set to Michael Koziarski
Did you really post that updated patch?
-
Tom Lea August 29th, 2008 @ 11:33 AM
Yeah, removed the old one to save confusion...
added the
args.shift.dup
. -
Repository August 29th, 2008 @ 07:53 PM
- State changed from new to committed
(from [db26b47b9f4dbebd478a5fe6c0dcd38b8697939a]) Ensure that calling content_tag_for in a helper doesn't cause duplicate output.
Signed-off-by: Michael Koziarski michael@koziarski.com [#871 state:committed] http://github.com/rails/rails/co...
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>
People watching this ticket
Attachments
Tags
Referenced by
- 871 content_tag_for should behave like content_tag Signed-off-by: Michael Koziarski michael@koziarski.com [#...