Ruby on Rails Friday, November 26, 2010

Whoa whoa whoa. form_for is for the VIEW. It generates html.
Specifcally, it generates <form> tags and etc...


On Nov 26, 2:35 pm, RobL <pgdst...@gmail.com> wrote:
> Hi there,
>
> I'm having an awful lot of trouble trying to use form_for inside a
> helper. Any ideas how to get this to work?
>
> module MyHelper
>
>    def button_thing_attempt_1
>      form_for(Button.new) do |f|
>       f.submit 'Push'
>     end
>   end
>
>   def button_thing_attempt_2
>     with_output_buffer(form_for(Button.new) do |f|
>       f.submit 'Push'
>     end)
>   end
>
> end
>
> While I get attempt 2 to render the form, the submit button is
> missing. I'm just not quite sure how to really capture the complete
> output of form_for.
>
> Many thanks for any help here
>
> RobL

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment