Custom Helper Using Block


#1

Hi :slight_smile:

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

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

<% 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
cooperate.

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 bloc.call(f) 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 = Proc.new() do |f| %>
Employer: <%= f.text_field :employer %>

<% end %>
then I created the form like normal and called bloc.call(f), 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.

-Kopf1988