<?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>Zepplock &#124; vova.org &#187; Ruby On Rails</title>
	<atom:link href="http://vova.org/category/ror/feed/" rel="self" type="application/rss+xml" />
	<link>http://vova.org</link>
	<description>Make Love not War</description>
	<lastBuildDate>Sun, 19 Jul 2009 19:19:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Incrementing and initializing counter in a view in 1 (one!) line</title>
		<link>http://vova.org/2009/07/19/incrementing-and-initializing-counter-in-a-view-in-1-one-line/</link>
		<comments>http://vova.org/2009/07/19/incrementing-and-initializing-counter-in-a-view-in-1-one-line/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 19:19:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby On Rails]]></category>

		<guid isPermaLink="false">http://vova.org/?p=31</guid>
		<description><![CDATA[Many times I have to make a counter that starts with 1 and monotonically incremented by 1 in Rails view. The typical example is when showing a list of things like:

7.1
7.2
7.3
....

The nice trick is to make it in 1 line:

&#60;li&#62;7.&#60;%= n = n + 1 rescue n = 1 %&#62;&#60;/li&#62;

instead of initializing &#8220;n&#8221; before the [...]]]></description>
			<content:encoded><![CDATA[<p>Many times I have to make a counter that starts with 1 and monotonically incremented by 1 in Rails view. The typical example is when showing a list of things like:</p>
<pre class="brush: ruby;">
7.1
7.2
7.3
....
</pre>
<p>The nice trick is to make it in 1 line:</p>
<pre class="brush: ruby;">
&lt;li&gt;7.&lt;%= n = n + 1 rescue n = 1 %&gt;&lt;/li&gt;
</pre>
<p>instead of initializing &#8220;n&#8221; before the loop (which requres extra line of code).</p>
<p>Now the question is: is this DRY enough? Is it?</p>
]]></content:encoded>
			<wfw:commentRss>http://vova.org/2009/07/19/incrementing-and-initializing-counter-in-a-view-in-1-one-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails JSON parser vs Open Flash Chart 2</title>
		<link>http://vova.org/2009/05/21/rails-json-parser-vs-open-flash-chart-2/</link>
		<comments>http://vova.org/2009/05/21/rails-json-parser-vs-open-flash-chart-2/#comments</comments>
		<pubDate>Thu, 21 May 2009 17:44:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby On Rails]]></category>

		<guid isPermaLink="false">http://72.14.184.46/?p=18</guid>
		<description><![CDATA[Well having multiple JSON parsers in Ruby on Rails is not a lot of fun.
Let me explain the situation. I was happily using &#8220;.to_json&#8221; (means Rails JSON parser) until I had to parse a POST request with JSON body.
I googled it like normal people do and found this:

require &#34;json&#34;
data = JSON.parse(input)

which worked fine until I [...]]]></description>
			<content:encoded><![CDATA[<p>Well having multiple JSON parsers in Ruby on Rails is not a lot of fun.</p>
<p>Let me explain the situation. I was happily using &#8220;.to_json&#8221; (means Rails JSON parser) until I had to parse a POST request with JSON body.<br />
I googled it like normal people do and found this:</p>
<pre class="brush: ruby;">
require &quot;json&quot;
data = JSON.parse(input)
</pre>
<p>which worked fine until I tried my Open Flash Charts. They were blank. No error message. Nothing.<br />
Removing the statement to require JSON fixed the issue.</p>
<p>I also tried </p>
<pre class="brush: ruby;">
require &quot;json/pure&quot;
</pre>
<p>and</p>
<pre class="brush: ruby;">
require &quot;json/ext&quot;
</pre>
<p>with similar results.</p>
<p>The short debugging session revealed that Ruby Open Flash Chart 2 helper is generating right JSON when Rails built-in generator is used.<br />
When using json, json/pure or json/ext the certain characters (slashes, quotes) in a resulting string were escaped (sometimes several times) which breaks the Open Flash Charts.</p>
<p>The solution was to use</p>
<pre class="brush: ruby;">
data = ActiveSupport::JSON.decode(input)
</pre>
<p>which is a call to parse the json string using the Rails built-in parser.</p>
]]></content:encoded>
			<wfw:commentRss>http://vova.org/2009/05/21/rails-json-parser-vs-open-flash-chart-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Zebra stripes for tables</title>
		<link>http://vova.org/2009/04/14/zebra-stripes-for-tables/</link>
		<comments>http://vova.org/2009/04/14/zebra-stripes-for-tables/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 17:40:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby On Rails]]></category>

		<guid isPermaLink="false">http://72.14.184.46/?p=8</guid>
		<description><![CDATA[Replacing

&#60;tr&#62;

with

&#60;tr class=&#34;&#60;%= cycle('one', 'two') %&#62;&#34;&#62;

in your tables will make lists easier to read.
Also apply the following css:

table tr.one td
{
background: grey;
}
table tr.two td
{
background: white;
}

]]></description>
			<content:encoded><![CDATA[<p>Replacing</p>
<pre class="brush: html;">
&lt;tr&gt;
</pre>
<p>with</p>
<pre class="brush: html;">
&lt;tr class=&quot;&lt;%= cycle('one', 'two') %&gt;&quot;&gt;
</pre>
<p>in your tables will make lists easier to read.</p>
<p>Also apply the following css:</p>
<pre class="brush: css;">
table tr.one td
{
background: grey;
}
table tr.two td
{
background: white;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://vova.org/2009/04/14/zebra-stripes-for-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Authlogic</title>
		<link>http://vova.org/2009/04/10/authlogic/</link>
		<comments>http://vova.org/2009/04/10/authlogic/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 17:36:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby On Rails]]></category>

		<guid isPermaLink="false">http://72.14.184.46/?p=3</guid>
		<description><![CDATA[After trying several Ruby on Rails authentication solutions I think that Authlogic is the best one. Authlogic can be installed as gem and as a plugin, does not require the use of generators (only optional scaffolding to save you time) and is very modular.
A very well written tutorial is here.
The github repository is here
]]></description>
			<content:encoded><![CDATA[<p>After trying several Ruby on Rails authentication solutions I think that Authlogic is the best one. Authlogic can be installed as gem and as a plugin, does not require the use of generators (only optional scaffolding to save you time) and is very modular.</p>
<p>A very well written tutorial is <a href="http://www.binarylogic.com/2008/11/3/tutorial-authlogic-basic-setup" target="_blank">here</a>.<br />
The github repository is <a href="http://github.com/binarylogic/authlogic/tree/master">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://vova.org/2009/04/10/authlogic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
