<?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>Hank Beaver &#187; block</title>
	<atom:link href="http://www.hankbeaver.com/index.php/tag/block/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hankbeaver.com</link>
	<description>Open-source, Internet technologist who works for MaxMedia located in Atlanta, GA, USA</description>
	<lastBuildDate>Tue, 09 Aug 2011 18:20:00 +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>has_many associations, using in helper tag and a little about blocks.</title>
		<link>http://www.hankbeaver.com/index.php/2008/02/10/has_many-associations-using-in-helper-tag-and-a-little-about-blocks/</link>
		<comments>http://www.hankbeaver.com/index.php/2008/02/10/has_many-associations-using-in-helper-tag-and-a-little-about-blocks/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 20:47:43 +0000</pubDate>
		<dc:creator>hbeaver</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[helper]]></category>
		<category><![CDATA[helper tags]]></category>

		<guid isPermaLink="false">http://1000fires.com/wordpress/?p=31</guid>
		<description><![CDATA[Soon the rest of this blog will deal with a basic overview of has_many associations and a practical use. For now look at this simple tag that uses has_many of a Blog model to show the Interests (or topics) for a given blog. You would use this helper_tag like so in your view, given that [...]]]></description>
			<content:encoded><![CDATA[<p>Soon the rest of this blog will deal with a basic overview of has_many associations and a practical use. For now look at this simple tag that uses has_many of a Blog model to show the Interests (or topics) for a given blog. You would use this helper_tag like so in your view, given that you have a single instance of a blog object called ‘blog’</p>
<p><%= more_ugly_interests_tag(blog) %></p>
<p>I hope this small article might help others:</p>
<pre>
#########################################
#Tag to show usage of has_many for a model.
#Ruby on Rails
#*this_model* is the actual instance of a blog or photo
#which has a list of interests.
#
#Call tag like this:
# <%= more_ugly_interests_tag(blog) %>
#the syntax below uses what Ruby calls a 'block'
#this is the format:
# some_variable_that_has_a_list.each { |list_item
# #do something with each item
# puts list_item + " !!!!"
# }
#########################################
def more_ugly_interests_tag(this_model)

to_return = "INTERESTS"

this_model.interests.each { |each_interest|

to_return =  << each_interest << "
"

}

#now we have end the whole function/method with what we want to return/print
to_return

end</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.hankbeaver.com/index.php/2008/02/10/has_many-associations-using-in-helper-tag-and-a-little-about-blocks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

