Form_for not working with Markaby

I’m playing around with Markaby and I decided to write a little blog
app. I’m running into issues with forms however. If I use form_for the
output of the form gets swallowed. For example:

form_for :article, @article do |f|
f.text_field :title
f.check_box :published
f.text_area :description
f.text_field :pub_date
f.text_area :content
end

gets rendered as an empty form tag. The above code of course works fine
in an rhtml file (with appropriate erb tags). Oddly form_tag works fine
in Markaby:

form_tag :action => ‘create’
text_field ‘article’, ‘title’
check_box ‘article’, ‘published’
text_area ‘article’, ‘description’
text_field ‘article’, ‘pub_date’
text_area ‘article’, ‘content’

end_form_tag

Renders the form just fine.

Anyone have thoughts on why this would be? I really like Markaby, and I
also prefer the form_for syntax, so ideally I would like to use both.
Any help would be appreciated.

Larry W.
http://www.approachingnormal.com
http://www.welcometoparenthood.com

try using @helpers.form_for and see what happens. Also, you might put
parens around the arguments just for kicks.

On 8/2/06, Jamie Orchard-Hays [email protected] wrote:

try using @helpers.form_for and see what happens. Also, you might put
parens around the arguments just for kicks.

No dice. I may just resort to using rhtml for my form partials and doing
the
rest in Markaby.

Perhaps there is a bug in form_for? Or perhaps in Markaby?

Jamie Orchard-hays wrote:

Perhaps there is a bug in form_for? Or perhaps in Markaby?

You need to output the fields like this:

form_for :article, @article do |f|
self << f.text_field :title
self << f.check_box :published
self << f.text_area :description
self << f.text_field :pub_date
self << f.text_area :content
end

Alternative, you may be able to wrap the collection of fields in a div,
but I haven’t tested that.

Stuart R. wrote:

The div wrapper seems to work (at least with form_tag blocks, haven’t
tried form_for though), for example:

I posted a more detailed explanation and workarounds to
http://code.whytheluckystiff.net/markaby/ticket/52

Chris S. wrote:

Alternative, you may be able to wrap the collection of fields in a div,
but I haven’t tested that.

The div wrapper seems to work (at least with form_tag blocks, haven’t
tried form_for though), for example:

form_tag({:action => ‘login’}, {:name => ‘login’}) do
div do
:
:
end
end

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