<?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>weedygarden.net &#187; Ruby</title>
	<atom:link href="http://www.weedygarden.net/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.weedygarden.net</link>
	<description>The random ramblings of a web developer.</description>
	<lastBuildDate>Mon, 25 Jan 2010 02:16:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>A Note on ActiveRecord Serialization and Objects</title>
		<link>http://www.weedygarden.net/2009/04/19/a-note-on-activerecord-serialization-and-objects/</link>
		<comments>http://www.weedygarden.net/2009/04/19/a-note-on-activerecord-serialization-and-objects/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 11:56:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.weedygarden.net/?p=53</guid>
		<description><![CDATA[Let&#8217;s say you&#8217;re serializing a ruby object for later use in a field of another model. class Foo &#60; ActiveRecord::Base serialize :bar end In this instance, assume an object of type &#8220;Bar&#8221; is what&#8217;s being serialized. After save, the data appears fine, but when you retrieve the data, instead of your Object you end up [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say you&#8217;re serializing a ruby object for later use in a field of another model.</p>
<pre><code>class Foo &lt; ActiveRecord::Base
  serialize :bar
end</code></pre>
<p>In this instance, assume an object of type &#8220;Bar&#8221; is what&#8217;s being serialized. After save, the data appears fine, but when you retrieve the data, instead of your Object you end up with yaml that looks like this:</p>
<pre>[#&lt;YAML::Object:0x3fcade8 @ivars={"attributes_cache"=&gt;{}, "attributes"=&gt;{"updated_at"=&gt;"2008-11-04 19:33:05", "id"=&gt;"1", "message"=&gt;"Hello World!", "created_at"=&gt;"2008-11-04 19:33:05"}}, @class="Bar"&gt;</pre>
<p>This most likely means that the model of the object being serialized is not loaded yet. This can be resolved by simply doing:</p>
<pre><code>class Foo &lt; ActiveRecord::Base
  Bar

  serialize :bar
end</code></pre>
<p>This will load the model before serialization occurs and you&#8217;ll be all set.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weedygarden.net/2009/04/19/a-note-on-activerecord-serialization-and-objects/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>What I Learned Today About ActionView</title>
		<link>http://www.weedygarden.net/2009/01/06/what-i-learned-today-about-actionview/</link>
		<comments>http://www.weedygarden.net/2009/01/06/what-i-learned-today-about-actionview/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 03:14:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.weedygarden.net/?p=35</guid>
		<description><![CDATA[I ran across a couple of ActionView tidbits that were new to me, so I thought I'd share.]]></description>
			<content:encoded><![CDATA[<p>I ran across a couple of ActionView tidbits that were new to me, so I thought I&#8217;d share.</p>
<p>You can comment out ERb delimiters in your view by adding a pound sign before the equal sign.</p>
<pre><code class="erb">
&lt;%#= str %&gt;
</code></pre>
<p>When rendering a collection, you have access to a zero-based &#8220;partial_<em>counter</em>&#8221; variable that increments on each iteration.</p>
<pre><code class="erb">
&lt;%= div_for(entry) do %&gt;
	&lt;%= entry_counter %&gt;
&lt;% end  %&gt;
</code></pre>
<p>Todays lesson brought you by chapter 10 of &#8220;The Rails Way&#8221; by Obie Fernandez.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weedygarden.net/2009/01/06/what-i-learned-today-about-actionview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
