Outputing to the browser, how?

Hello,
I’m writting some helper methods to write forms, so I have this working
code:
class TableFormBuilder < ActionView::Helpers::FormBuilder
[“file_field”, “password_field”, “text_field”].each do |name|
define_method(name) do |label, *args|
@template.content_tag(:tr,
@template.content_tag(:td,
@template.content_tag(:label, label.to_s.humanize)) +
@template.content_tag(:td, super))
end
end
end

From the documentation of content_tag, I see it has two styles:
content_tag(tag, content) or <% content_tag(tag) do %>content<% end %>

I’d like to use the second style, but I’m not in a view, so, how do I
output
to the browser the same way a view does?

Or asking in another way, how do I make this work:

class TableFormBuilder < ActionView::Helpers::FormBuilder
[“file_field”, “password_field”, “text_field”].each do |name|
define_method(name) do |label, *args|
@template.content_tag(:tr) do
@template.content_tag(:td) do
@template.content_tag(:label, label.to_s.humanize)
end
+
@template.content_tag(:td, super)
end
end
end
end

Thank you.

J. Pablo Fernández [email protected] (http://pupeno.com)

this is a known bug/inconsistency. see here: <http://
dev.rubyonrails.org/ticket/7857>

wait for rails 1.2.4 to make it more sensible or patch it yourself.

greetings,
Phil

Hi Pablo

If your apps is databse intensive,you owe toy ourself to take a look
at activescaffold :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs