<?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>Sean&#039;s Blog &#187; Facebook</title>
	<atom:link href="http://seanbehan.com/tag/facebook/feed/" rel="self" type="application/rss+xml" />
	<link>http://seanbehan.com</link>
	<description>Web Programming, Ruby on Rails, Wordpress, PHP from Burlington, Vermont</description>
	<lastBuildDate>Wed, 18 Jan 2012 21:44:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Simple Activity Stream Implementation in Rails</title>
		<link>http://seanbehan.com/ruby-on-rails/simple-activity-stream-implementation-in-rails/</link>
		<comments>http://seanbehan.com/ruby-on-rails/simple-activity-stream-implementation-in-rails/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 01:00:21 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[activtiy stream]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[newsfeed]]></category>
		<category><![CDATA[polymorphic associations]]></category>
		<category><![CDATA[simple]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1138</guid>
		<description><![CDATA[There are many ways to tackle the Facebook style activity stream feature for your app. The simplest approach, which you can tack on at almost any moment, is what I&#8217;ll describe here. You don&#8217;t have to create a new model for news feed items or create any polymorphic associations. You simply query for the records [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fruby-on-rails%2Fsimple-activity-stream-implementation-in-rails%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Simple Activity Stream Implementation in Rails" data-url="http://seanbehan.com/ruby-on-rails/simple-activity-stream-implementation-in-rails/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>There are many ways to tackle the Facebook style activity stream feature for your app. The simplest approach, which you can tack on at almost any moment, is what I&#8217;ll describe here. You don&#8217;t have to create a new model for news feed items or create any polymorphic associations. You simply query for the records on separate models you would like aggregated in the stream, and render a partial for that record, which Rails will map for you. </p>
<pre class="wp-code-highlight prettyprint">
# in app/controllers/home_controller.rb
def index
 @activity_stream = (Forum.find(:all, :limit =&amp;gt; 10, :conditions=&amp;gt;[&quot;created_at &amp;gt; ?&quot;, 1.day.ago]) + ForumPost.find(:all, :limit =&amp;gt; 10)).sort_by {|item| - item.created_at.to_i}
end
</pre>
<p>The sort_by method at the end places all of your feed item into descending chronological order. Omit the minus sign and they will be sorted in ascending order.</p>
<pre class="wp-code-highlight prettyprint">
sort_by {|item| - item.created_at.to_i} # in descending chronological order
</pre>
<p>Show your latest activity in your views&#8230;</p>
<pre class="wp-code-highlight prettyprint">
#app/views/home/index.html.erb
&amp;lt;%= render @activity_stream rescue nil %&amp;gt;
</pre>
<p>This assumes that you will have created the partials for each resource using Rails conventions i.e., you have in created the partials for the models like so app/views/_[the model name].html.erb. In this instance, you should have app/views/forums/_forum.html.erb and app/views/forum_posts/_forum_post.html.erb </p>
<p>You can rename the partials to something like _stream_forum.html.erb, if you already have the forum partial gainfully employed. You&#8217;ll need to change the view and prob. throw it into a loop to either check for a condition or use _stream_[model name].html.erb as the convention for any stream items. </p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/ruby-on-rails/simple-activity-stream-implementation-in-rails/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adding RSS Graffiti to my Facebook Page</title>
		<link>http://seanbehan.com/business/adding-rss-graffiti-to-my-facebook-page/</link>
		<comments>http://seanbehan.com/business/adding-rss-graffiti-to-my-facebook-page/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 17:59:26 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[feed]]></category>
		<category><![CDATA[rss]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=623</guid>
		<description><![CDATA[I added the RSS Graffiti application to my Facebook account. It&#8217;s a nifty app that lets you add any valid Rss/Atom feed to your profile (includes publishing to your wall) and to your pages.]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fbusiness%2Fadding-rss-graffiti-to-my-facebook-page%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Adding RSS Graffiti to my Facebook Page" data-url="http://seanbehan.com/business/adding-rss-graffiti-to-my-facebook-page/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>I added the RSS Graffiti application to my Facebook account. It&#8217;s a nifty app that lets you add any valid Rss/Atom feed to your profile (includes publishing to your wall) and to your pages.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/business/adding-rss-graffiti-to-my-facebook-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

