<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Taking the Pain Out of Complex Forms in Rails</title>
	<atom:link href="http://www.deskchecked.com/2008/07/20/taking-the-pain-out-of-complex-forms-in-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.deskchecked.com/2008/07/20/taking-the-pain-out-of-complex-forms-in-rails/</link>
	<description>Thomas Lee's programming blog</description>
	<lastBuildDate>Sat, 27 Mar 2010 16:01:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: tom</title>
		<link>http://www.deskchecked.com/2008/07/20/taking-the-pain-out-of-complex-forms-in-rails/comment-page-1/#comment-5065</link>
		<dc:creator>tom</dc:creator>
		<pubDate>Mon, 18 May 2009 06:35:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.vector-seven.com/?p=77#comment-5065</guid>
		<description>@Randy, glad you found the plugin useful. I&#039;ve not tried migrating from 2.1.x to 2.3.x myself, but the old Rails parameter parsing code has been completely stripped out. You&#039;ll find the new parameter parsing code in the glue code for rack. Unfortunately the new semantics don&#039;t match the form_collections semantics exactly, so you may need to go to the effort of porting it unfortunately. I&#039;ve tried and tried to push the semantics in the plugin, but it fell on deaf ears. Somewhat understandable from their perspective (i.e. they&#039;re trying not to break stuff), but IMO a mistake from a practical point of view.

From what I understand it seems that they&#039;re going to stick with the old semantics (i.e. foo[0]=1 parses to {:foo =&gt; { 0 =&gt; 1 }}), except the parser will actually *work* for more complex forms. Once Ruby 1.9 goes mainstream with its out-of-the-box ordered implementation of Hash, this should be more-or-less what you want anyway. Until then, I&#039;m not sure what they plan to do or if they&#039;ve resolved all the issues I raised regarding the old parameter parsing code.

Anyway, let me know if you get stuck.</description>
		<content:encoded><![CDATA[<p>@Randy, glad you found the plugin useful. I&#8217;ve not tried migrating from 2.1.x to 2.3.x myself, but the old Rails parameter parsing code has been completely stripped out. You&#8217;ll find the new parameter parsing code in the glue code for rack. Unfortunately the new semantics don&#8217;t match the form_collections semantics exactly, so you may need to go to the effort of porting it unfortunately. I&#8217;ve tried and tried to push the semantics in the plugin, but it fell on deaf ears. Somewhat understandable from their perspective (i.e. they&#8217;re trying not to break stuff), but IMO a mistake from a practical point of view.</p>
<p>From what I understand it seems that they&#8217;re going to stick with the old semantics (i.e. foo[0]=1 parses to {:foo =&gt; { 0 =&gt; 1 }}), except the parser will actually *work* for more complex forms. Once Ruby 1.9 goes mainstream with its out-of-the-box ordered implementation of Hash, this should be more-or-less what you want anyway. Until then, I&#8217;m not sure what they plan to do or if they&#8217;ve resolved all the issues I raised regarding the old parameter parsing code.</p>
<p>Anyway, let me know if you get stuck.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Randy</title>
		<link>http://www.deskchecked.com/2008/07/20/taking-the-pain-out-of-complex-forms-in-rails/comment-page-1/#comment-4956</link>
		<dc:creator>Randy</dc:creator>
		<pubDate>Tue, 12 May 2009 23:25:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.vector-seven.com/?p=77#comment-4956</guid>
		<description>I&#039;ve used your form_colletions plugin with great success with Rails 2.1.0.  I&#039;m now looking into Rails 2.3.2 and wonder if I can just remove your plugin and Rails will understand/parse the same data as your plugin did?  When I try to start up the app, I get &quot;uninitialized constant ActionController::AbstractRequest&quot; and I can trace it back to the patch_url_encoded_pair_parser.rb on the line where your class is declared: &quot;class ActionController::AbstractRequest::UrlEncodedPairParser&quot;</description>
		<content:encoded><![CDATA[<p>I&#8217;ve used your form_colletions plugin with great success with Rails 2.1.0.  I&#8217;m now looking into Rails 2.3.2 and wonder if I can just remove your plugin and Rails will understand/parse the same data as your plugin did?  When I try to start up the app, I get &#8220;uninitialized constant ActionController::AbstractRequest&#8221; and I can trace it back to the patch_url_encoded_pair_parser.rb on the line where your class is declared: &#8220;class ActionController::AbstractRequest::UrlEncodedPairParser&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tom</title>
		<link>http://www.deskchecked.com/2008/07/20/taking-the-pain-out-of-complex-forms-in-rails/comment-page-1/#comment-3776</link>
		<dc:creator>tom</dc:creator>
		<pubDate>Fri, 06 Mar 2009 22:14:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.vector-seven.com/?p=77#comment-3776</guid>
		<description>Hi Val,

It worked for me:

--

$ git clone http://www.deskchecked.com/git/rails/plugins/form_collections.git
Initialized empty Git repository in /home/tom/code/form_collections/.git/
Getting alternates list for http://www.deskchecked.com/git/rails/plugins/form_collections.git
Getting pack list for http://www.deskchecked.com/git/rails/plugins/form_collections.git
Getting index for pack 86313bbb9653e23f9e0147b999855b2eef4c0cb9
Getting pack 86313bbb9653e23f9e0147b999855b2eef4c0cb9
 which contains ffbc5e77cb080323d6c303f533f8d73f4c69cecc
walk ffbc5e77cb080323d6c303f533f8d73f4c69cecc
walk b8c333aca41f1ba5cb8498a7d738c200edf43e61
walk e54adf67ab1acf4af42324e1a896747b8624f8df
walk 6df788f2baeef083c9f2ad8ae2acb1a5de6c09e9
walk d59a3df8129589e1c77d7e07172e8cfbdcc8b0af
walk d5ed70379c78f1f0909ba05994aeb9a44230dcfa
walk 41ecbabcecde4e81afda5735e01f2769e194552a
walk d5fe0450fb9dea98a36488bef802b467329e5c58
$ cd form_collections
$ ls
init.rb     lib          Rakefile  tasks  uninstall.rb
install.rb  MIT-LICENSE  README    test
$ 

--

Judging by that git-clone error (&quot;curl not found&quot;) you may need to install curl or something. Check your git installation, or drop me an email if you continue to have problems.</description>
		<content:encoded><![CDATA[<p>Hi Val,</p>
<p>It worked for me:</p>
<p>&#8211;</p>
<p>$ git clone <a href="http://www.deskchecked.com/git/rails/plugins/form_collections.git" rel="nofollow">http://www.deskchecked.com/git/rails/plugins/form_collections.git</a><br />
Initialized empty Git repository in /home/tom/code/form_collections/.git/<br />
Getting alternates list for <a href="http://www.deskchecked.com/git/rails/plugins/form_collections.git" rel="nofollow">http://www.deskchecked.com/git/rails/plugins/form_collections.git</a><br />
Getting pack list for <a href="http://www.deskchecked.com/git/rails/plugins/form_collections.git" rel="nofollow">http://www.deskchecked.com/git/rails/plugins/form_collections.git</a><br />
Getting index for pack 86313bbb9653e23f9e0147b999855b2eef4c0cb9<br />
Getting pack 86313bbb9653e23f9e0147b999855b2eef4c0cb9<br />
 which contains ffbc5e77cb080323d6c303f533f8d73f4c69cecc<br />
walk ffbc5e77cb080323d6c303f533f8d73f4c69cecc<br />
walk b8c333aca41f1ba5cb8498a7d738c200edf43e61<br />
walk e54adf67ab1acf4af42324e1a896747b8624f8df<br />
walk 6df788f2baeef083c9f2ad8ae2acb1a5de6c09e9<br />
walk d59a3df8129589e1c77d7e07172e8cfbdcc8b0af<br />
walk d5ed70379c78f1f0909ba05994aeb9a44230dcfa<br />
walk 41ecbabcecde4e81afda5735e01f2769e194552a<br />
walk d5fe0450fb9dea98a36488bef802b467329e5c58<br />
$ cd form_collections<br />
$ ls<br />
init.rb     lib          Rakefile  tasks  uninstall.rb<br />
install.rb  MIT-LICENSE  README    test<br />
$ </p>
<p>&#8211;</p>
<p>Judging by that git-clone error (&#8221;curl not found&#8221;) you may need to install curl or something. Check your git installation, or drop me an email if you continue to have problems.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Val</title>
		<link>http://www.deskchecked.com/2008/07/20/taking-the-pain-out-of-complex-forms-in-rails/comment-page-1/#comment-3493</link>
		<dc:creator>Val</dc:creator>
		<pubDate>Thu, 26 Feb 2009 18:52:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.vector-seven.com/?p=77#comment-3493</guid>
		<description>Thanks! 
But it looks like the repository is invalid:

/usr/bin/git-clone: 374: curl: not found
---

git clone www.deskchecked.com/git/rails/plugins/form_collections.git
Initialized empty Git repository ...

git clone \
    http://www.vector-seven.com/git/rails/plugins/form_collections.git</description>
		<content:encoded><![CDATA[<p>Thanks!<br />
But it looks like the repository is invalid:</p>
<p>/usr/bin/git-clone: 374: curl: not found<br />
&#8212;</p>
<p>git clone <a href="http://www.deskchecked.com/git/rails/plugins/form_collections.git" rel="nofollow">http://www.deskchecked.com/git/rails/plugins/form_collections.git</a><br />
Initialized empty Git repository &#8230;</p>
<p>git clone \<br />
    <a href="http://www.vector-seven.com/git/rails/plugins/form_collections.git" rel="nofollow">http://www.vector-seven.com/git/rails/plugins/form_collections.git</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric</title>
		<link>http://www.deskchecked.com/2008/07/20/taking-the-pain-out-of-complex-forms-in-rails/comment-page-1/#comment-1456</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Mon, 11 Aug 2008 23:09:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.vector-seven.com/?p=77#comment-1456</guid>
		<description>Yep, was able to get it. Works great, too! Thanks</description>
		<content:encoded><![CDATA[<p>Yep, was able to get it. Works great, too! Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas Lee &#187; Fixing Rails Nested Forms (or: HashWithIndifferentAccess is evil)</title>
		<link>http://www.deskchecked.com/2008/07/20/taking-the-pain-out-of-complex-forms-in-rails/comment-page-1/#comment-1450</link>
		<dc:creator>Thomas Lee &#187; Fixing Rails Nested Forms (or: HashWithIndifferentAccess is evil)</dc:creator>
		<pubDate>Sun, 10 Aug 2008 05:41:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.vector-seven.com/?p=77#comment-1450</guid>
		<description>[...] UPDATE Since I wrote this post, I&#8217;ve written a plugin that replaces Rails&#8217; parameter parsing implementation to make dealing with complex nested forms easier still. Refer to Taking the Pain Out of Complex Forms in Rails. [...]</description>
		<content:encoded><![CDATA[<p>[...] UPDATE Since I wrote this post, I&#8217;ve written a plugin that replaces Rails&#8217; parameter parsing implementation to make dealing with complex nested forms easier still. Refer to Taking the Pain Out of Complex Forms in Rails. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tom</title>
		<link>http://www.deskchecked.com/2008/07/20/taking-the-pain-out-of-complex-forms-in-rails/comment-page-1/#comment-1449</link>
		<dc:creator>tom</dc:creator>
		<pubDate>Sun, 10 Aug 2008 05:26:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.vector-seven.com/?p=77#comment-1449</guid>
		<description>Eric: is it any better now? Migrated from lighttpd to Apache and I screwed up the configuration.

Ivan: Glad you found it useful. :) It&#039;s been a thorn in my side a few times in the past.</description>
		<content:encoded><![CDATA[<p>Eric: is it any better now? Migrated from lighttpd to Apache and I screwed up the configuration.</p>
<p>Ivan: Glad you found it useful. <img src='http://www.deskchecked.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  It&#8217;s been a thorn in my side a few times in the past.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan</title>
		<link>http://www.deskchecked.com/2008/07/20/taking-the-pain-out-of-complex-forms-in-rails/comment-page-1/#comment-1445</link>
		<dc:creator>Ivan</dc:creator>
		<pubDate>Sat, 09 Aug 2008 03:39:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.vector-seven.com/?p=77#comment-1445</guid>
		<description>I&#039;ve been looking for a fix to this problem for months, and attempted writing my own hacked UrlEncodedPairParser with little success. I&#039;ve tested this plugin in my application and it seems to work perfectly, even with multilevel nested arrays by adding an index option to the block params of the form helper.

Might need some hacking to work with Javascript added elements such as in Ryan&#039;s complex forms recipe.
 
I would love to see this functionality in Rails 2.2</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been looking for a fix to this problem for months, and attempted writing my own hacked UrlEncodedPairParser with little success. I&#8217;ve tested this plugin in my application and it seems to work perfectly, even with multilevel nested arrays by adding an index option to the block params of the form helper.</p>
<p>Might need some hacking to work with Javascript added elements such as in Ryan&#8217;s complex forms recipe.</p>
<p>I would love to see this functionality in Rails 2.2</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric</title>
		<link>http://www.deskchecked.com/2008/07/20/taking-the-pain-out-of-complex-forms-in-rails/comment-page-1/#comment-1443</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Tue, 05 Aug 2008 18:16:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.vector-seven.com/?p=77#comment-1443</guid>
		<description>I&#039;m having trouble cloning the plug-in with git, and when I click the link to the repo, I receive a 403 error. Any suggestions?</description>
		<content:encoded><![CDATA[<p>I&#8217;m having trouble cloning the plug-in with git, and when I click the link to the repo, I receive a 403 error. Any suggestions?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tom</title>
		<link>http://www.deskchecked.com/2008/07/20/taking-the-pain-out-of-complex-forms-in-rails/comment-page-1/#comment-1387</link>
		<dc:creator>tom</dc:creator>
		<pubDate>Mon, 21 Jul 2008 12:58:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.vector-seven.com/?p=77#comment-1387</guid>
		<description>Yep, Koz pointed this out on the mailing list. And yes, it&#039;s dealing with part of the same problem. But the parsing itself is the big thing here:

&lt;pre&gt;&lt;code&gt;
ryan = User.create( {
  :login =&gt; &#039;ryan&#039;,
  :phone_numbers =&gt; [
    { :area_code =&gt; &#039;919&#039;, :number =&gt; &#039;123-4567&#039; },
    { :area_code =&gt; &#039;920&#039;, :number =&gt; &#039;123-8901&#039; }
  ]
})
&lt;/code&gt;&lt;/pre&gt;

Try building a form to generate :phone_numbers using edge. It&#039;s not a matter of just using &quot;user[phone_numbers][]&quot; or &quot;user[phone_numbers][0]&quot;. The former won&#039;t work because a &quot;PhoneNumber&quot; has two fields. The latter, because it builds a Hash instead of an Array. The existing form parsing code will limit the usefulness of this new capability.</description>
		<content:encoded><![CDATA[<p>Yep, Koz pointed this out on the mailing list. And yes, it&#8217;s dealing with part of the same problem. But the parsing itself is the big thing here:</p>
<pre><code>
ryan = User.create( {
  :login => 'ryan',
  :phone_numbers => [
    { :area_code => '919', :number => '123-4567' },
    { :area_code => '920', :number => '123-8901' }
  ]
})
</code></pre>
<p>Try building a form to generate :phone_numbers using edge. It&#8217;s not a matter of just using &#8220;user[phone_numbers][]&#8221; or &#8220;user[phone_numbers][0]&#8220;. The former won&#8217;t work because a &#8220;PhoneNumber&#8221; has two fields. The latter, because it builds a Hash instead of an Array. The existing form parsing code will limit the usefulness of this new capability.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
