<?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>My own tech words... &#187; Ruby on Rails</title>
	<atom:link href="http://blog.lucastex.com/category/tech/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.lucastex.com</link>
	<description></description>
	<lastBuildDate>Mon, 12 Apr 2010 12:01:41 +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>Quick Tip [RoR]: Ordenando valores fixos em um select</title>
		<link>http://blog.lucastex.com/2008/12/16/quick-tip-ror-ordenando-valores-fixos-em-um-select/</link>
		<comments>http://blog.lucastex.com/2008/12/16/quick-tip-ror-ordenando-valores-fixos-em-um-select/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 23:08:45 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[quicktips]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=72</guid>
		<description><![CDATA[Quando temos um campo select em um form html usando Ruby on Rails, o procedimento &#8216;default&#8217; (para selects nÃ£o dinÃ¢micos), seria algo assim&#8230;.
&#60;%= f.select :campo, {}, @valores %&#62;
Onde @valores foi definido por um hash, por exemplo:
@valores = {'Lucas' =&#62;'123', 'Xpto' =&#62; '111', 'Sbrobow' =&#62; '444'}
PorÃ©m, como (agora fazendo um paralelo com Java), isso refletiria algo [...]]]></description>
			<content:encoded><![CDATA[<p>Quando temos um campo select em um form html usando Ruby on Rails, o procedimento &#8216;default&#8217; (para selects nÃ£o dinÃ¢micos), seria algo assim&#8230;.</p>
<pre><b>&lt;%= f.select :campo, {}, @valores %&gt;</b></pre>
<p>Onde @valores foi definido por um hash, por exemplo:</p>
<pre><b>@valores = {'Lucas' =&gt;'123', 'Xpto' =&gt; '111', 'Sbrobow' =&gt; '444'}</b></pre>
<p>PorÃ©m, como (agora fazendo um paralelo com Java), isso refletiria algo semelhante a um <em>HashMap</em> e nÃ£o a um <em>LinkedHashMap</em>, fazendo com que a ordem das entradas nÃ£o seja garantida, para garantir isto, a maneira mais fÃ¡cil Ã© usar um Array de arrays, desta maneira:</p>
<pre><b>@valores = [['Lucas', '123'], ['Xpto','111'], ['Sbrobow','444']]</b></pre>
<p>Go!</p>
<p>[]s,</p>
<p>Lucas</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2008/12/16/quick-tip-ror-ordenando-valores-fixos-em-um-select/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
