Forum: Ruby on Rails Custom Helper Using Block

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
kopf1988 (Guest)
on 2009-05-15 02:45
(Received via mailing list)
Hi :)

What should I do to try to create a contact form that works like this:

<%= contact_form do |f| %>
Employer: <%= f.text_field :employer %><br />
<% end %>

The problem so far is that I seem to have a tough time calling things
like f.remote_form_for(@contact) in a helper - it just doesn't

Or you could try to help me in another way? I tried putting a block/
proc in the view to do this, but when I use the fields
show up twice - once where I had originally defined them, and once
where I used the call function. Any ideas?? What I tried was like

<% bloc = do |f| %>
Employer: <%= f.text_field :employer %><br />
<% end %>
then I created the form like normal and called, but it
showed up in two places. Suggestions? Thanks for any help on either of
these... I really want to make this form more ruby-esque.

This topic is locked and can not be replied to.