<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web Development &#38; Stuff &#187; Ruby</title>
	<atom:link href="http://web-development-blog.co.uk/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://web-development-blog.co.uk</link>
	<description>Some interesting findings from web-dev land...</description>
	<lastBuildDate>Mon, 02 Apr 2012 15:10:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Submit form with jQuery gotcha</title>
		<link>http://web-development-blog.co.uk/2009/10/29/submit-form-with-jquery-gotcha/</link>
		<comments>http://web-development-blog.co.uk/2009/10/29/submit-form-with-jquery-gotcha/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 15:40:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://web-development-blog.co.uk/?p=211</guid>
		<description><![CDATA[It seems that you can&#8217;t submit a form with jQuery using:
1$&#40;'form#myform'&#41;.submit&#40;&#41;;
If you have an input in the form with the name attribute set to submit. So this doesn&#8217;t work:
1&#60;input type=&#34;submit&#34; name=&#34;submit&#34; value=&#34;Press to continue&#34; /&#62;
Change the name attribute to something else other than submit and it works fine ;]
]]></description>
			<content:encoded><![CDATA[<p>It seems that you can&#8217;t submit a form with jQuery using:</p>
<div class="codecolorer-container css " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="css codecolorer" style="font-family:Monaco,Lucida Console,monospace">$<span class="br0">&#40;</span><span class="st0">'form#myform'</span><span class="br0">&#41;</span>.submit<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></td></tr></tbody></table></div>
<p>If you have an input in the form with the name attribute set to submit. So this doesn&#8217;t work:</p>
<div class="codecolorer-container css " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="css codecolorer" style="font-family:Monaco,Lucida Console,monospace">&lt;input type<span class="sy0">=</span><span class="st0">&quot;submit&quot;</span> name<span class="sy0">=</span><span class="st0">&quot;submit&quot;</span> value<span class="sy0">=</span><span class="st0">&quot;Press to continue&quot;</span> /<span class="sy0">&gt;</span></div></td></tr></tbody></table></div>
<p>Change the name attribute to something else other than submit and it works fine ;]</p>
]]></content:encoded>
			<wfw:commentRss>http://web-development-blog.co.uk/2009/10/29/submit-form-with-jquery-gotcha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Will Paginate result / pages / totals helper</title>
		<link>http://web-development-blog.co.uk/2009/03/31/will-paginate-result-pages-totals-helper/</link>
		<comments>http://web-development-blog.co.uk/2009/03/31/will-paginate-result-pages-totals-helper/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 09:17:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://web-development-blog.co.uk/?p=129</guid>
		<description><![CDATA[This might be handy for anyone that&#8217;s using the Ruby on Rails will_paginate plugin/gem. It&#8217;s a helper that displays the result totals, current viewing range and page range based on an input Will Paginate collection array.
1234567891011def render_pagination_totals&#40;will_paginate_collection=false&#41;
&#160; if will_paginate_collection and !will_paginate_collection.total_entries.zero?
&#160; 
&#160; if will_paginate_collection.total_entries &#60; &#40;will_paginate_collection.current_page * will_paginate_collection.per_page&#41;
&#160; &#160; end_of_range = will_paginate_collection.total_entries
&#160; else
&#160; &#160; end_of_range [...]]]></description>
			<content:encoded><![CDATA[<p>This might be handy for anyone that&#8217;s using the Ruby on Rails will_paginate plugin/gem. It&#8217;s a helper that displays the result totals, current viewing range and page range based on an input Will Paginate collection array.</p>
<div class="codecolorer-container ruby " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="ruby codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw1">def</span> render_pagination_totals<span class="br0">&#40;</span>will_paginate_collection=<span class="kw2">false</span><span class="br0">&#41;</span><br />
&nbsp; <span class="kw1">if</span> will_paginate_collection <span class="kw1">and</span> !will_paginate_collection.<span class="me1">total_entries</span>.<span class="me1">zero</span>?<br />
&nbsp; <br />
&nbsp; <span class="kw1">if</span> will_paginate_collection.<span class="me1">total_entries</span> <span class="sy0">&lt;</span> <span class="br0">&#40;</span>will_paginate_collection.<span class="me1">current_page</span> <span class="sy0">*</span> will_paginate_collection.<span class="me1">per_page</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; end_of_range = will_paginate_collection.<span class="me1">total_entries</span><br />
&nbsp; <span class="kw1">else</span><br />
&nbsp; &nbsp; end_of_range = <span class="br0">&#40;</span>will_paginate_collection.<span class="me1">current_page</span> <span class="sy0">*</span> will_paginate_collection.<span class="me1">per_page</span><span class="br0">&#41;</span><br />
&nbsp; <span class="kw1">end</span><br />
<br />
&nbsp; <span class="st0">'&lt;p&gt;Viewing &lt;b&gt;'</span> <span class="sy0">+</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>will_paginate_collection.<span class="me1">current_page</span> <span class="sy0">*</span> will_paginate_collection.<span class="me1">per_page</span><span class="br0">&#41;</span> <span class="sy0">-</span> <span class="br0">&#40;</span>will_paginate_collection.<span class="me1">per_page</span>.<span class="me1">to_i</span> <span class="sy0">-</span> <span class="nu0">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span>.<span class="me1">to_s</span> <span class="sy0">+</span> <span class="st0">' to '</span> <span class="sy0">+</span> end_of_range.<span class="me1">to_s</span> <span class="sy0">+</span> <span class="st0">'&lt;/b&gt; of a total of &lt;b&gt;'</span> <span class="sy0">+</span> will_paginate_collection.<span class="me1">total_entries</span>.<span class="me1">to_s</span> <span class="sy0">+</span> <span class="st0">'&lt;/b&gt; results. Page &lt;b&gt;'</span> <span class="sy0">+</span> will_paginate_collection.<span class="me1">current_page</span>.<span class="me1">to_s</span> <span class="sy0">+</span> <span class="st0">'&lt;/b&gt; of &lt;b&gt; '</span> <span class="sy0">+</span> will_paginate_collection.<span class="me1">total_pages</span>.<span class="me1">to_s</span> <span class="sy0">+</span> <span class="st0">'&lt;/b&gt;.&lt;/p&gt;'</span><br />
<span class="kw1">end</span></div></td></tr></tbody></table></div>
<p>Usage:</p>
<div class="codecolorer-container ruby " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br /></div></td><td><div class="ruby codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="sy0">&lt;%</span>= render_pagination_totals<span class="br0">&#40;</span>@will_paginate_collection<span class="br0">&#41;</span> <span class="sy0">%&gt;</span><br />
<br />
# Output: Viewing 1 to 10 of a total of 17 results. Page 1 of &nbsp;2.</div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://web-development-blog.co.uk/2009/03/31/will-paginate-result-pages-totals-helper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails error_messages_for quirks</title>
		<link>http://web-development-blog.co.uk/2009/03/24/ruby-on-rails-error_messages_for-quirks/</link>
		<comments>http://web-development-blog.co.uk/2009/03/24/ruby-on-rails-error_messages_for-quirks/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 09:23:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://web-development-blog.co.uk/?p=125</guid>
		<description><![CDATA[Don&#8217;t forget kids, error_messages_for seems only to like a symbol or a string of the instance variable name of your instantiated Active Record object (model). Not the object itself.
So this doesn&#8217;t work:
1&#60;%= error_messages_for&#40;@instance_variable_name&#41; %&#62;
Neither does this but then again it shouldn&#8217;t! (blogging for my own records):
1&#60;%= error_messages_for&#40;'active_record_model_class_name'&#41; %&#62;
This is what you want:
1&#60;%= error_messages_for&#40;:instance_variable_name&#41; %&#62;
A string [...]]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t forget kids, error_messages_for seems only to like a symbol or a string of the instance variable name of your instantiated Active Record object (model). Not the object itself.</p>
<p>So this <b>doesn&#8217;t work</b>:</p>
<div class="codecolorer-container ruby " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="ruby codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="sy0">&lt;%</span>= error_messages_for<span class="br0">&#40;</span>@instance_variable_name<span class="br0">&#41;</span> <span class="sy0">%&gt;</span></div></td></tr></tbody></table></div>
<p><b>Neither does this</b> but then again it shouldn&#8217;t! (blogging for my own records):</p>
<div class="codecolorer-container ruby " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="ruby codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="sy0">&lt;%</span>= error_messages_for<span class="br0">&#40;</span><span class="st0">'active_record_model_class_name'</span><span class="br0">&#41;</span> <span class="sy0">%&gt;</span></div></td></tr></tbody></table></div>
<p>This is what you want:</p>
<div class="codecolorer-container ruby " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="ruby codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="sy0">&lt;%</span>= error_messages_for<span class="br0">&#40;</span><span class="re3">:instance_variable_name</span><span class="br0">&#41;</span> <span class="sy0">%&gt;</span></div></td></tr></tbody></table></div>
<p>A string will do the same trick too:</p>
<div class="codecolorer-container ruby " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="ruby codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="sy0">&lt;%</span>= error_messages_for<span class="br0">&#40;</span><span class="st0">'instance_variable_name'</span><span class="br0">&#41;</span> <span class="sy0">%&gt;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://web-development-blog.co.uk/2009/03/24/ruby-on-rails-error_messages_for-quirks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails dynamic select menu with blank first option using select helper</title>
		<link>http://web-development-blog.co.uk/2009/03/23/ruby-on-rails-dynamic-select-menu-with-blank-first-option-using-select-helper/</link>
		<comments>http://web-development-blog.co.uk/2009/03/23/ruby-on-rails-dynamic-select-menu-with-blank-first-option-using-select-helper/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 14:24:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://web-development-blog.co.uk/?p=120</guid>
		<description><![CDATA[Managed to create a dynamic select menu with this code today. It includes a blank first value:
1&#60;%= select&#40;&#34;event&#34;, &#34;search_type&#34;, EventType.find&#40;:all&#41;.collect &#123;&#124;et&#124; &#91;et.name, et.id&#93; &#125;.sort, &#123; :include_blank =&#62; 'all' &#125;&#41; %&#62;
]]></description>
			<content:encoded><![CDATA[<p>Managed to create a dynamic select menu with this code today. It includes a blank first value:</p>
<div class="codecolorer-container ruby " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="ruby codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="sy0">&lt;%</span>= <span class="kw3">select</span><span class="br0">&#40;</span><span class="st0">&quot;event&quot;</span>, <span class="st0">&quot;search_type&quot;</span>, EventType.<span class="me1">find</span><span class="br0">&#40;</span><span class="re3">:all</span><span class="br0">&#41;</span>.<span class="me1">collect</span> <span class="br0">&#123;</span><span class="sy0">|</span>et<span class="sy0">|</span> <span class="br0">&#91;</span>et.<span class="me1">name</span>, et.<span class="me1">id</span><span class="br0">&#93;</span> <span class="br0">&#125;</span>.<span class="me1">sort</span>, <span class="br0">&#123;</span> <span class="re3">:include_blank</span> <span class="sy0">=&gt;</span> <span class="st0">'all'</span> <span class="br0">&#125;</span><span class="br0">&#41;</span> <span class="sy0">%&gt;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://web-development-blog.co.uk/2009/03/23/ruby-on-rails-dynamic-select-menu-with-blank-first-option-using-select-helper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a Ruby Hash from 2 arrays (ranges in this case)</title>
		<link>http://web-development-blog.co.uk/2009/03/23/create-a-ruby-hash-from-2-arrays-ranges-in-this-case/</link>
		<comments>http://web-development-blog.co.uk/2009/03/23/create-a-ruby-hash-from-2-arrays-ranges-in-this-case/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 10:53:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://web-development-blog.co.uk/?p=115</guid>
		<description><![CDATA[To create a Hash from a couple of Arrays you can do this in Ruby. I&#8217;m using a couple of Array ranges in this example.
OK the keys (strings):
1keys = &#40;'1'..'99'&#41;.to_a
Now the values (integers):
1values = &#40;1..99&#41;.to_a
Now the instantiation of the Hash object from the 2 arrays:
1hash = Hash&#91;*keys.zip&#40;values&#41;.flatten&#93;
]]></description>
			<content:encoded><![CDATA[<p>To create a Hash from a couple of Arrays you can do this in Ruby. I&#8217;m using a couple of Array ranges in this example.</p>
<p>OK the keys (strings):</p>
<div class="codecolorer-container ruby " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="ruby codecolorer" style="font-family:Monaco,Lucida Console,monospace">keys = <span class="br0">&#40;</span><span class="st0">'1'</span>..<span class="st0">'99'</span><span class="br0">&#41;</span>.<span class="me1">to_a</span></div></td></tr></tbody></table></div>
<p>Now the values (integers):</p>
<div class="codecolorer-container ruby " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="ruby codecolorer" style="font-family:Monaco,Lucida Console,monospace">values = <span class="br0">&#40;</span>1..99<span class="br0">&#41;</span>.<span class="me1">to_a</span></div></td></tr></tbody></table></div>
<p>Now the instantiation of the Hash object from the 2 arrays:</p>
<div class="codecolorer-container ruby " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="ruby codecolorer" style="font-family:Monaco,Lucida Console,monospace">hash = <span class="kw4">Hash</span><span class="br0">&#91;</span><span class="sy0">*</span>keys.<span class="me1">zip</span><span class="br0">&#40;</span>values<span class="br0">&#41;</span>.<span class="me1">flatten</span><span class="br0">&#93;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://web-development-blog.co.uk/2009/03/23/create-a-ruby-hash-from-2-arrays-ranges-in-this-case/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails Hpricot parser- uninitialized constant SearchController::Hpricot</title>
		<link>http://web-development-blog.co.uk/2009/03/19/ruby-on-rails-hpricot-parser-uninitialized-constant-searchcontroller-hpricot/</link>
		<comments>http://web-development-blog.co.uk/2009/03/19/ruby-on-rails-hpricot-parser-uninitialized-constant-searchcontroller-hpricot/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 12:32:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://web-development-blog.co.uk/?p=109</guid>
		<description><![CDATA[I installed the Hpricot gem today from the Hpricot GitHub homepage. I tried to parse some XML and got this error:
1uninitialized constant SearchController::Hpricot
Suddenly realised I should of required the library but the install documentation didn&#8217;t mention that. Managed to fix the issue with this line in my environment.rb
1config.gem &#34;hpricot&#34;
]]></description>
			<content:encoded><![CDATA[<p>I installed the Hpricot gem today from the <a href="http://wiki.github.com/why/hpricot">Hpricot GitHub homepage</a>. I tried to parse some XML and got this error:</p>
<div class="codecolorer-container text " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">uninitialized constant SearchController::Hpricot</div></td></tr></tbody></table></div>
<p>Suddenly realised I should of required the library but the install documentation didn&#8217;t mention that. Managed to fix the issue with this line in my environment.rb</p>
<div class="codecolorer-container ruby " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="ruby codecolorer" style="font-family:Monaco,Lucida Console,monospace">config.<span class="me1">gem</span> <span class="st0">&quot;hpricot&quot;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://web-development-blog.co.uk/2009/03/19/ruby-on-rails-hpricot-parser-uninitialized-constant-searchcontroller-hpricot/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Nested form labels / inputs technique using Ruby on Rails form helpers</title>
		<link>http://web-development-blog.co.uk/2009/03/18/nested-form-labels-inputs-technique-using-ruby-on-rails-form-helpers/</link>
		<comments>http://web-development-blog.co.uk/2009/03/18/nested-form-labels-inputs-technique-using-ruby-on-rails-form-helpers/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 16:36:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web accessibility]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://web-development-blog.co.uk/?p=101</guid>
		<description><![CDATA[It was, (not 100% up on WAG2 yet) a W3C WAI accessibility recommendation to nest your form fields (inputs/selects etc) inside your label tags. So they were contained by the label much like you&#8217;d put an  &#60;img&#62; tag inside an &#60;a&#62; tag to make it a link.
The Rails helpers don&#8217;t seem to have much [...]]]></description>
			<content:encoded><![CDATA[<p>It was, (not 100% up on WAG2 yet) a W3C WAI accessibility recommendation to nest your form fields (inputs/selects etc) inside your label tags. So they were contained by the label much like you&#8217;d put an  &lt;img&gt; tag inside an &lt;a&gt; tag to make it a link.</p>
<p>The Rails helpers don&#8217;t seem to have much scope for this (please correct me) but it is hack-able doing some concatenation stuff like this:</p>
<div class="codecolorer-container ruby " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="ruby codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="sy0">&lt;%</span>= f.<span class="me1">label</span> <span class="st0">&quot;Screen name:&quot;</span> <span class="sy0">+</span> <span class="br0">&#40;</span>f.<span class="me1">text_field</span> <span class="re3">:screen_name</span><span class="br0">&#41;</span> <span class="sy0">%&gt;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://web-development-blog.co.uk/2009/03/18/nested-form-labels-inputs-technique-using-ruby-on-rails-form-helpers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding class attribute to Ruby on Rails form_for helper</title>
		<link>http://web-development-blog.co.uk/2009/03/18/adding-class-attribute-to-ruby-on-rails-form_for-helper/</link>
		<comments>http://web-development-blog.co.uk/2009/03/18/adding-class-attribute-to-ruby-on-rails-form_for-helper/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 16:27:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://web-development-blog.co.uk/?p=97</guid>
		<description><![CDATA[Following on from my last post, sorry folks a bit more Rails bashing. What happened to convention over configuration and the principle of least surprise?
So to add a plain old class attribute to a form tag using the form_for helper you need to do (notice this time we&#8217;re declaring the actual html options with the [...]]]></description>
			<content:encoded><![CDATA[<p>Following on from <a href="/2009/03/17/adding-class-attribute-to-ruby-on-rails-form_tag-helper/">my last post</a>, sorry folks a bit more Rails bashing. What happened to convention over configuration and the principle of least surprise?</p>
<p>So to add a plain old class attribute to a form tag using the form_for helper you need to do (notice this time we&#8217;re declaring the actual html options with the :html symbol):</p>
<div class="codecolorer-container ruby " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br /></div></td><td><div class="ruby codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="sy0">&lt;%</span> form_for<span class="br0">&#40;</span>@user, <span class="re3">:html</span> <span class="sy0">=&gt;</span> <span class="br0">&#123;</span> <span class="re3">:class</span> <span class="sy0">=&gt;</span> <span class="st0">&quot;class_name_here&quot;</span><span class="br0">&#125;</span> <span class="br0">&#41;</span> <span class="kw1">do</span> <span class="sy0">|</span>f<span class="sy0">|</span> <span class="sy0">%&gt;</span><br />
&nbsp; # Form goes here<br />
<span class="sy0">&lt;%</span> <span class="kw1">end</span> <span class="sy0">%&gt;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://web-development-blog.co.uk/2009/03/18/adding-class-attribute-to-ruby-on-rails-form_for-helper/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Adding class attribute to Ruby on Rails form_tag helper</title>
		<link>http://web-development-blog.co.uk/2009/03/17/adding-class-attribute-to-ruby-on-rails-form_tag-helper/</link>
		<comments>http://web-development-blog.co.uk/2009/03/17/adding-class-attribute-to-ruby-on-rails-form_tag-helper/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 09:53:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://web-development-blog.co.uk/?p=94</guid>
		<description><![CDATA[Some days I love Rails, some days it really frustrates me.
Anyways spent 10 minutes remembering the syntax for the form_for helper to add a regular class attribute. The second hash of parameters are the HTML ones! Thought I&#8217;d blog it for my own records:
123&#60;% form_tag&#40; &#123; :action =&#62; &#34;destroy&#34;, :method =&#62; &#34;delete&#34; &#125;, :class =&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Some days I love Rails, some days it really frustrates me.</p>
<p>Anyways spent 10 minutes remembering the syntax for the form_for helper to add a regular class attribute. The second hash of parameters are the HTML ones! Thought I&#8217;d blog it for my own records:</p>
<div class="codecolorer-container ruby " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br /></div></td><td><div class="ruby codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="sy0">&lt;%</span> form_tag<span class="br0">&#40;</span> <span class="br0">&#123;</span> <span class="re3">:action</span> <span class="sy0">=&gt;</span> <span class="st0">&quot;destroy&quot;</span>, <span class="re3">:method</span> <span class="sy0">=&gt;</span> <span class="st0">&quot;delete&quot;</span> <span class="br0">&#125;</span>, <span class="re3">:class</span> <span class="sy0">=&gt;</span> <span class="st0">&quot;class_name_here&quot;</span> <span class="br0">&#41;</span> <span class="kw1">do</span> <span class="sy0">%&gt;</span><br />
&nbsp; #Form goes here<br />
<span class="sy0">&lt;%</span> <span class="kw1">end</span> <span class="sy0">%&gt;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://web-development-blog.co.uk/2009/03/17/adding-class-attribute-to-ruby-on-rails-form_tag-helper/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails equivalent of PHP_SELF &#8211; request.path</title>
		<link>http://web-development-blog.co.uk/2009/03/06/ruby-on-rails-equivalent-of-php_self-requestpath/</link>
		<comments>http://web-development-blog.co.uk/2009/03/06/ruby-on-rails-equivalent-of-php_self-requestpath/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 16:44:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://web-development-blog.co.uk/?p=91</guid>
		<description><![CDATA[This in Ruby/Rails:
1&#60;%= request.path %&#62;
Seems to be the equivalent of this in PHP:
1&#60;?=$_SERVER&#91;'PHP_SELF'&#93;?&#62;
Handy for submitting things to themselves with out any parameters being passed.
]]></description>
			<content:encoded><![CDATA[<p>This in Ruby/Rails:</p>
<div class="codecolorer-container ruby " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="ruby codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="sy0">&lt;%</span>= request.<span class="me1">path</span> <span class="sy0">%&gt;</span></div></td></tr></tbody></table></div>
<p>Seems to be the equivalent of this in PHP:</p>
<div class="codecolorer-container php " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="sy1">&lt;?=</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st_h">'PHP_SELF'</span><span class="br0">&#93;</span><span class="sy1">?&gt;</span></div></td></tr></tbody></table></div>
<p>Handy for submitting things to themselves with out any parameters being passed.</p>
]]></content:encoded>
			<wfw:commentRss>http://web-development-blog.co.uk/2009/03/06/ruby-on-rails-equivalent-of-php_self-requestpath/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

