<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>The Hitchhiker's Guide to Ruby On Rails Galaxy</title>
	<atom:link href="http://arjunghosh.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://arjunghosh.wordpress.com</link>
	<description>Records of my voyage through RoR Galaxy</description>
	<lastBuildDate>Tue, 17 Mar 2009 13:47:06 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='arjunghosh.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/af4c75d0bd398acbbce3eab9cc7b2d84?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>The Hitchhiker's Guide to Ruby On Rails Galaxy</title>
		<link>http://arjunghosh.wordpress.com</link>
	</image>
			<item>
		<title>How to parse a tweet text from Twitter using Ruby to parse-out &#8216;@&#8217; and &#8216;#&#8217;</title>
		<link>http://arjunghosh.wordpress.com/2009/03/05/how-to-parse-a-tweet-text-from-twitter-using-ruby-to-parse-out-and/</link>
		<comments>http://arjunghosh.wordpress.com/2009/03/05/how-to-parse-a-tweet-text-from-twitter-using-ruby-to-parse-out-and/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 09:38:44 +0000</pubDate>
		<dc:creator>arjunghosh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://arjunghosh.wordpress.com/?p=112</guid>
		<description><![CDATA[Well lot of us love @twitter and also Ruby, and some time work on both  
And often we need to do the folowing with a tweet
Well I had to do the following quite often:-
Take out the &#8216;@&#8217; (i.e. @replies )and &#8216;#&#8217; (i.e. hashtags ) from a tweet and separate it from the text part.
For example, we [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=112&subd=arjunghosh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Well lot of us love <a href="https://twitter.com/">@twitter</a> and also <a href="http://www.ruby-lang.org/en/">Ruby</a>, and some time work on both <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>And often we need to do the folowing with a <strong><a href="http://en.wikipedia.org/wiki/Tweet">tweet</a></strong></p>
<p>Well I had to do the following quite often:-</p>
<p>Take out the <strong>&#8216;@&#8217;</strong> (i.e. <a href="http://help.twitter.com/forums/10711/entries/14023">@replies</a> )and <strong>&#8216;#&#8217;</strong> (i.e. <a href="http://twitter.pbwiki.com/Hashtags">hashtags</a> ) from a tweet and separate it from the text part.</p>
<p>For example, we have a <a href="http://en.wikipedia.org/wiki/Tweet">tweet</a>:</p>
<p><span style="color:#99cc00;"> @myfriend1 @myfriend2 this is a sample text #link #text</span></p>
<p>Now I want this tweet to be seperated into the following Array:</p>
<p><span style="color:#99cc00;"> ['myfriend1','myfriend2']</span></p>
<p><span style="color:#99cc00;">['link','text']</span></p>
<p>and the text only &#8211; <span style="color:#99cc00;">["this is a sample text "]</span></p>
<p>So first had to build a RegE, and then using the ever useful <a href="http://function.name/in/Ruby/gsub">.gsub</a> <a href="http://www.ruby-doc.org/core/classes/String.html">method</a> of <a href="http://www.ruby-lang.org/en/">Ruby</a>, created the following:</p>
<blockquote><p><span style="color:#99cc00;"><strong> parsed_text = tweet.text.gsub(/ ?(@\w+)| ?(#\w+)/) { |a|  ((a.include?(&#8216;#&#8217;)) ? tags : replies) &lt;&lt; a.strip.gsub(/#|@/,&#8221;); &#8221; }</strong></span></p></blockquote>
<p>So the <strong>parsed_text</strong> has the final text only.  <strong>tags</strong> is an <strong><a href="http://www.ruby-doc.org/core/classes/Array.html">Array</a> </strong>which will contain the <strong>hashtags </strong>and <strong>replies</strong> is an <strong><a href="http://www.ruby-doc.org/core/classes/Array.html">Array</a> </strong>which will contain the <strong>@replies</strong>.</p>
<p>The RegEx <strong><span style="color:#99cc00;">/ ?(@\w+)| ?(#\w+)/ </span><span style="color:#99cc00;"><span style="font-weight:normal;"><span style="color:#000000;">extracts and seperates the hashtags &amp; the @replies and place them in two seperate arrays.</span></span></span></strong></p>
<p><strong><span style="color:#99cc00;"><span style="font-weight:normal;">The RegEx <strong><span style="color:#99cc00;">/#|@/,&#8221;</span></strong> <span style="color:#000000;">only reples the </span></span><span style="color:#000000;">&#8216;@&#8217;</span><span style="font-weight:normal;"><span style="color:#000000;"> and </span></span><span style="color:#000000;">&#8216;#&#8217;</span><span style="font-weight:normal;"><span style="color:#000000;"> symbols in the extracted array elements.</span></span></span></strong></p>
<p>And you can download it from <a href="http://gist.github.com">Gist</a> here <a href="http://gist.github.com/78498">http://gist.github.com/78498</a></p>
<p>Also while working on creating the above regular expressions, I found this interesting RegEx testing site called <a href="http://bit.ly/N0Hpf">www.rubular.com</a> which will help you write regular expressions very easily.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arjunghosh.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arjunghosh.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arjunghosh.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arjunghosh.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arjunghosh.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arjunghosh.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arjunghosh.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arjunghosh.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arjunghosh.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arjunghosh.wordpress.com/112/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=112&subd=arjunghosh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://arjunghosh.wordpress.com/2009/03/05/how-to-parse-a-tweet-text-from-twitter-using-ruby-to-parse-out-and/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4ea2c24103fcfd789efd9c16cd2d59b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arjunghosh</media:title>
		</media:content>
	</item>
		<item>
		<title>A very hip &amp; cool parenting site called lil&#8217;grams which is built on RubyOnRails!</title>
		<link>http://arjunghosh.wordpress.com/2009/03/03/a-very-hip-cool-parenting-site-called-lilgram-which-is-built-on-rubyonrails/</link>
		<comments>http://arjunghosh.wordpress.com/2009/03/03/a-very-hip-cool-parenting-site-called-lilgram-which-is-built-on-rubyonrails/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 16:32:27 +0000</pubDate>
		<dc:creator>arjunghosh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cool]]></category>
		<category><![CDATA[lilgrams]]></category>
		<category><![CDATA[parenting]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://arjunghosh.wordpress.com/?p=88</guid>
		<description><![CDATA[Just wanted to do a very quick post on this very new hip &#38; cool site on parenting &#8211; lil&#8217;grams


And do you know what, its has been made in RubyOnRails!
Do check out this site. It the brain child of Greg Narain who is a well know serial entrepreneur &#38; social media expert.
Already people are talking about it and when its [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=88&subd=arjunghosh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Just wanted to do a very quick post on this very new hip &amp; cool site on parenting &#8211; <strong><a href="http://bit.ly/mWFyu" target="_blank">lil&#8217;grams</a></strong></p>
<p><strong><a href="http://www.lilgrams.com/"><img class="alignnone size-full wp-image-110" title="app1" src="http://arjunghosh.files.wordpress.com/2009/03/app1.png?w=50&#038;h=51" alt="app1" width="50" height="51" /></a></strong></p>
<p><strong></strong></p>
<p>And do you know what, its has been made in <a href="http://rubyonrails.org/">RubyOnRails</a>!</p>
<p>Do check out this site. It the brain child of <span>Greg Narain</span> who is a well know serial entrepreneur &amp; <span>social media expert.</span></p>
<p>Already people are <a href="http://bit.ly/3EnU9R">talking</a> about it and when its yet to be launched!!</p>
<p>Actually people like <a href="http://www.nytimes.com/2008/09/11/fashion/11Tots.html?_r=2&amp;scp=1&amp;sq=lilgrams&amp;st=cse">NYTime</a>, <a href="http://www.centernetworks.com/lilgrams-launches-baby-twitter-pownce-dogster">CNET</a>, <a href="http://mashable.com/2008/12/18/baby-blogging/">Mashable</a><a href="http://mashable.com/2008/11/01/family-sites/?cp=all"> have</a> been talking about <strong><a href="http://bit.ly/mWFyu">lil&#8217;grams</a></strong> for sometime. Even <a href="http://www.killerstartups.com/User-Gen-Content/littlegrams-com-document-your-kid-s-every-step">KillerStartups</a> has a mention.</p>
<p>There is also a <a href="http://search.twitter.com/search?max_id=1274021222&amp;page=2&amp;q=%23lilgrams+OR+@lilgrams+OR+%23lilttlegrams+OR+lil'grams">buzz</a> on <a href="https://twitter.com">twitter</a> too <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Yes, some would say its been in making for quite sometime. But as they say patience has its virtue. Ultimately its a labour of love.</p>
<p>It been really a long journey for me personally too. Have been working on it for quite some time. I still  remember those days of sleepless night, long meeting, etc. </p>
<p>Though I am yet to be a dad <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  (a.k.a am un-married), I too  feel like a proud parent my self on the <a href="http://www.socialtwister.com/2007/10/31/unveiling-lilgrams-a-parents-best-micro-blog/">birth</a> of <a href="http://www.lilgrams.com/">lil&#8217;grams</a>  which I feel is literally my baby! </p>
<p>If you like (and also dont <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) do tell us about it <a href="http://getsatisfaction.com/lilgrams">here</a> which I assure will be promptly replied to <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arjunghosh.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arjunghosh.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arjunghosh.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arjunghosh.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arjunghosh.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arjunghosh.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arjunghosh.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arjunghosh.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arjunghosh.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arjunghosh.wordpress.com/88/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=88&subd=arjunghosh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://arjunghosh.wordpress.com/2009/03/03/a-very-hip-cool-parenting-site-called-lilgram-which-is-built-on-rubyonrails/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4ea2c24103fcfd789efd9c16cd2d59b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arjunghosh</media:title>
		</media:content>

		<media:content url="http://arjunghosh.files.wordpress.com/2009/03/app1.png" medium="image">
			<media:title type="html">app1</media:title>
		</media:content>
	</item>
		<item>
		<title>Two of the best help &amp; guide sites for RubyOnRails and Ruby</title>
		<link>http://arjunghosh.wordpress.com/2009/02/27/two-of-the-best-help-guide-sites-for-rubyonrails-and-ruby/</link>
		<comments>http://arjunghosh.wordpress.com/2009/02/27/two-of-the-best-help-guide-sites-for-rubyonrails-and-ruby/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 10:45:53 +0000</pubDate>
		<dc:creator>arjunghosh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[guides]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://arjunghosh.wordpress.com/?p=123</guid>
		<description><![CDATA[Well this is essentially a note to self and well to others too.
The best help documents online for Ruby On Rails and Ruby are these AJAXified websites which allows real-time searching of sytanx and commands.
For Ruby On Rails, it is:
www.railsbrain.com
And for Ruby, we have:
www.rubybrain.com
And the best part is you can even download them so that you can use it offline!
Another [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=123&subd=arjunghosh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Well this is essentially a note to self and well to others too.<br />
The best help documents online for <a href="http://rubyonrails.org/"><strong>Ruby On Rails</strong></a> and <a href="http://www.ruby-lang.org/en/"><strong>Ruby</strong></a> are these <strong>AJAX</strong><em><strong>ified</strong></em> websites which allows <strong><em>real-time</em></strong> searching of <strong>sytanx </strong>and <strong>commands</strong>.</p>
<p>For <a href="http://rubyonrails.org/"><strong>Ruby On Rails</strong></a>, it is:</p>
<h2><strong><span style="color:#99cc00;"><a href="http://bit.ly/1Q9RG"><span style="color:#99cc00;">www.railsbrain.com</span></a></span></strong></h2>
<p>And for <strong><a href="http://www.ruby-lang.org/en/">Ruby</a></strong>, we have:</p>
<h2><span style="color:#99cc00;"><a href="http://bit.ly/kzA1d"><span style="color:#99cc00;">www.rubybrain.com</span></a></span></h2>
<p>And the best part is you can even download them so that you can use it <strong><em>offline</em><span style="font-weight:normal;">!</span></strong></p>
<p>Another good resource for Rails documentaion and help guides is the newly created collaborative effort <strong><a href="http://guides.rails.info/">Rails Guide</a></strong> project. This was started by <a href="http://twitter.com/lifo">@lifo</a> as a project to give the rails community a good documentaion which was painfully lacking till now. Since its a collaborative effort, you can <a href="http://wiki.github.com/lifo/docrails">participate</a> <a href="http://github.com/lifo/docrails/tree/master">here</a>. There is even <a href="http://twitter.com/lebreeze/status/1315509066">buzz</a> about this project on <a href="http://twitter.com">@twitter</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arjunghosh.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arjunghosh.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arjunghosh.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arjunghosh.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arjunghosh.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arjunghosh.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arjunghosh.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arjunghosh.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arjunghosh.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arjunghosh.wordpress.com/123/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=123&subd=arjunghosh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://arjunghosh.wordpress.com/2009/02/27/two-of-the-best-help-guide-sites-for-rubyonrails-and-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4ea2c24103fcfd789efd9c16cd2d59b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arjunghosh</media:title>
		</media:content>
	</item>
		<item>
		<title>Using ERB as a dynamic template to create a file whose contents are dynamic</title>
		<link>http://arjunghosh.wordpress.com/2009/02/17/using-erb-as-a-dynamic-template-to-create-a-file-whose-contents-are-dynamic/</link>
		<comments>http://arjunghosh.wordpress.com/2009/02/17/using-erb-as-a-dynamic-template-to-create-a-file-whose-contents-are-dynamic/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 10:23:03 +0000</pubDate>
		<dc:creator>arjunghosh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[pastie]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://arjunghosh.wordpress.com/?p=85</guid>
		<description><![CDATA[The following code will create a temporary file for say attaching a vcard file to email.The following code is dynamic to use ERB as a template to create the file dynamically every time with the variable &#8220;telephone&#8221;,&#8221;location&#8221;,&#8221;email&#8221; which gets binded to the ERB file and is under scope.
The code is:-
 {
telephone = &#8220;347-27456&#8243;
location = &#8220;New [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=85&subd=arjunghosh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The following code will create a temporary file for say attaching a vcard file to email.The following code is dynamic to use ERB as a template to create the file dynamically every time with the variable &#8220;telephone&#8221;,&#8221;location&#8221;,&#8221;email&#8221; which gets binded to the ERB file and is under scope.<br />
The code is:-</p>
<blockquote><p><span style="color:#99cc00;"> {<br />
telephone = &#8220;347-27456&#8243;<br />
location = &#8220;New Delhi&#8221;<br />
email = &#8220;xyz@gmail.com&#8221;<br />
vcard = ERB.new( File.open(&#8216;address.vcard.erb&#8217; ){ |f| f.read } ).result( binding )<br />
f = File.new(&#8220;temp_file.vcf&#8221;,&#8221;wb&#8221;)<br />
f.puts vcard<br />
f.close<br />
}</span></p></blockquote>
<p>and in pastie is <a href="http://pastie.org/319687">here</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arjunghosh.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arjunghosh.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arjunghosh.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arjunghosh.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arjunghosh.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arjunghosh.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arjunghosh.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arjunghosh.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arjunghosh.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arjunghosh.wordpress.com/85/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=85&subd=arjunghosh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://arjunghosh.wordpress.com/2009/02/17/using-erb-as-a-dynamic-template-to-create-a-file-whose-contents-are-dynamic/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4ea2c24103fcfd789efd9c16cd2d59b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arjunghosh</media:title>
		</media:content>
	</item>
		<item>
		<title>Model name in RubyOnRails should ALWAYS be singular!!!</title>
		<link>http://arjunghosh.wordpress.com/2008/12/23/model-name-in-rubyonrails-should-always-be-singular/</link>
		<comments>http://arjunghosh.wordpress.com/2008/12/23/model-name-in-rubyonrails-should-always-be-singular/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 14:57:20 +0000</pubDate>
		<dc:creator>arjunghosh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[activerecord]]></category>
		<category><![CDATA[conventions]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[Newbie]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://arjunghosh.wordpress.com/?p=76</guid>
		<description><![CDATA[Model names in RubyOnRails should be Singular. This will create Table name as corresponding Plural names.
You have got to remember that about model naming conventions in rails. . 
I know this is a very basic concept in RubyOnRails but sometimes these simple basic concepts are the ones which slip through the cracks.
Example:
&#62; ruby script/generate model Post
This will create a Model [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=76&subd=arjunghosh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Model names</strong> in <a href="http://rubyonrails.org/">RubyOnRails</a> should be <strong>Singular</strong>. This will create <strong>Table name</strong> as corresponding <strong>Plural</strong> names.</p>
<p>You have got to remember that about model naming conventions in rails. . </p>
<p><span class="entry-content">I know this is a very basic concept in <a href="http://rubyonrails.org/">RubyOnRails</a> but sometimes these simple basic concepts are the ones which slip through the cracks.</span></p>
<p><strong>Example:</strong></p>
<blockquote><p><span style="color:#99cc00;">&gt; ruby script/generate model Post</span></p></blockquote>
<p>This will create a Model by the name <strong>&#8220;Post&#8221; </strong>i.e. singular in english language and a migration to create a table by the name <strong>&#8220;Posts&#8221; </strong>which is plural form of <strong>&#8220;Post&#8221;.</strong></p>
<p>I have even put this into a pastie for easier remembarance <a rel="nofollow" href="http://pastie.org/345491" target="_blank">http://pastie.org/345491</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arjunghosh.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arjunghosh.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arjunghosh.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arjunghosh.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arjunghosh.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arjunghosh.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arjunghosh.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arjunghosh.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arjunghosh.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arjunghosh.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=76&subd=arjunghosh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://arjunghosh.wordpress.com/2008/12/23/model-name-in-rubyonrails-should-always-be-singular/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4ea2c24103fcfd789efd9c16cd2d59b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arjunghosh</media:title>
		</media:content>
	</item>
		<item>
		<title>I am Back!!! and so many interesting changes to Rails&#8230;</title>
		<link>http://arjunghosh.wordpress.com/2008/12/23/i-am-back-and-so-many-interesting-changes-to-rails/</link>
		<comments>http://arjunghosh.wordpress.com/2008/12/23/i-am-back-and-so-many-interesting-changes-to-rails/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 14:44:54 +0000</pubDate>
		<dc:creator>arjunghosh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[rail2.0]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rails2.2]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[screencast]]></category>

		<guid isPermaLink="false">http://arjunghosh.wordpress.com/?p=54</guid>
		<description><![CDATA[Yeah I know its been long since I have been away. Well lot has happened between my last journey  through RubyOnRail&#8217;s universe from May 28,2008 to the current date. New Rails 2.0 screencast by Fabio Akita  which is unspired by the Creating a Weblog in 15 minutes the original screencast by David Hansson , Newer version of RubyOnRails (v 2.2.2) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=54&subd=arjunghosh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span>Yeah I know its been long since I have been away. Well lot has happened between my last journey </span> <span>through RubyOnRail&#8217;s universe from <a href="http://arjunghosh.wordpress.com/2008/05/28/going-through-a-design-theme-shift/">May 28,2008</a> to the current date. New <a href="http://www.akitaonrails.com/2007/12/10/the-first-rails-2-0-screencast-english">Rails 2.0 screencast</a> by <a href="http://www.akitaonrails.com">Fabio Akita</a> </span> <span>which is unspired by the <a href="http://media.rubyonrails.org/video/rails_take2_with_sound.mov">Creating a Weblog in 15 minutes</a> the original screencast by <a href="http://www.loudthinking.com/about.html">David Hansson</a> ,</span> <span>Newer version of <a href="http://weblog.rubyonrails.com/2008/11/21/rails-2-2-i18n-http-validators-thread-safety-jruby-1-9-compatibility-docs">RubyOnRails (v 2.2.2)</a> are out, Rails officially moved to <a href="http://github.com/rails/rails/tree/master">GitHub</a> and supports <a href="http://git.or.cz/"></a></span> <span><a href="http://git.or.cz/">Git</a> as the <a href="http://en.wikipedia.org/wiki/Revision_control">VCS</a> of choice, Rails <a href="http://www.koziarski.net/archives/2008/5/4/thread-safety">thread</a><a href="http://www.koziarski.net/archives/2008/5/4/thread-safety"><span style="color:#000000;text-decoration:none;"> </span></a><a href="http://www.koziarski.net/archives/2008/5/4/thread-safety">safety</a> is in (though how is <a href="http://blog.headius.com/2008/08/qa-what-thread-safe-rails-means.html">that</a> <a href="http://m.onkey.org/2008/10/23/thread-safety-for-your-rails">actually</a> <a href="http://github.com/lifo/docrails/wikis/thread-safety-of-plugins-and-gems">useful</a> ?), </span> <span>lot of <a href="http://guides.rubyonrails.org/2_2_release_notes.html">nifty changes</a> in Rails v2.2. </span> <span>So all in all lot of things have been happening. </span></p>
<p><span>I will try to be more regular here.</span> <span>In mean time, everyone who twitter and in New Delhi, India can check out the <a href="http://twitter.com/rubyonraildelhi">twitter.com/rubyonraildelhi</a></span> <span>where I have been posting regular rubyonrail updates and local information. You can find me on</span> <span><a href="https://twitter.com/">twitter</a> here at <a href="https://twitter.com/arjunghosh">@arjunghosh</a>.</span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arjunghosh.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arjunghosh.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arjunghosh.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arjunghosh.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arjunghosh.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arjunghosh.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arjunghosh.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arjunghosh.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arjunghosh.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arjunghosh.wordpress.com/54/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=54&subd=arjunghosh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://arjunghosh.wordpress.com/2008/12/23/i-am-back-and-so-many-interesting-changes-to-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://media.rubyonrails.org/video/rails_take2_with_sound.mov" length="54364199" type="video/quicktime" />
	
		<media:content url="http://1.gravatar.com/avatar/b4ea2c24103fcfd789efd9c16cd2d59b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arjunghosh</media:title>
		</media:content>
	</item>
		<item>
		<title>Going through a Design &amp; Theme shift</title>
		<link>http://arjunghosh.wordpress.com/2008/05/28/going-through-a-design-theme-shift/</link>
		<comments>http://arjunghosh.wordpress.com/2008/05/28/going-through-a-design-theme-shift/#comments</comments>
		<pubDate>Wed, 28 May 2008 14:29:00 +0000</pubDate>
		<dc:creator>arjunghosh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://arjunghosh.wordpress.com/?p=47</guid>
		<description><![CDATA[Right now am going through a design and Theme sift as the present theme is much better suited to display codes. So please be patient. Thanks  
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=47&subd=arjunghosh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Right now am going through a design and Theme sift as the present theme is much better suited to display codes. So please be patient. Thanks <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/arjunghosh.wordpress.com/47/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/arjunghosh.wordpress.com/47/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arjunghosh.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arjunghosh.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arjunghosh.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arjunghosh.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arjunghosh.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arjunghosh.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arjunghosh.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arjunghosh.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arjunghosh.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arjunghosh.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=47&subd=arjunghosh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://arjunghosh.wordpress.com/2008/05/28/going-through-a-design-theme-shift/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4ea2c24103fcfd789efd9c16cd2d59b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arjunghosh</media:title>
		</media:content>
	</item>
		<item>
		<title>How to force the browser to not cache in Rails</title>
		<link>http://arjunghosh.wordpress.com/2008/04/29/how-to-force-the-browser-to-not-cache-in-rails/</link>
		<comments>http://arjunghosh.wordpress.com/2008/04/29/how-to-force-the-browser-to-not-cache-in-rails/#comments</comments>
		<pubDate>Tue, 29 Apr 2008 08:23:08 +0000</pubDate>
		<dc:creator>arjunghosh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rubyonrails]]></category>

		<guid isPermaLink="false">http://arjunghosh.wordpress.com/?p=45</guid>
		<description><![CDATA[This is a quick note to self. Though,I found this excellent post by Chad while looking for something else but this post had a excellent note on browser cache also. So this post is mostly a re-post from Chad&#8217;s.
So here it goes:
To ensure that the page isn’t cached by the browser and will always be [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=45&subd=arjunghosh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This is a quick note to self. Though,I found this excellent post by <a href="http://giantrobots.thoughtbot.com/2008/4/25/pitfalls-in-restful-wizards">Chad</a> while looking for something else but this post had a excellent note on browser cache also. So this post is mostly a re-post from Chad&#8217;s.</p>
<p>So here it goes:</p>
<p>To ensure that the page isn’t cached by the browser and will always be re-fetched, add a before_filter to the purchases controller which calls a private method on ApplicationController:</p>
<blockquote><p><code style="font-size:15px;"><span style="color:#99cc00;">before_filter :no_cache, <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> nly =&gt; [:new]</span><br />
<span style="color:#99cc00;">private</span><br />
<span style="color:#99cc00;">def no_cache<br />
response.headers["Last-Modified"] = Time.now.httpdate<br />
response.headers["Expires"] = 0</span><br />
<span style="color:#99cc00;"># HTTP 1.0<br />
response.headers["Pragma"] = "no-cache"</span><br />
<span style="color:#99cc00;"># HTTP 1.1 'pre-check=0, post-check=0' (IE specific)<br />
response.headers["Cache-Control"] = 'no-store, no-cache, must-revalidate, max-age=0, pre-check=0, post-check=0'<br />
end</span></code></p></blockquote>
<p>Now there is a catch &#8211; ‘not caching’ only works in Firefox.</p>
<p>Now the above code should have worked for all browser, but it did not work in Safari or in IE 6 and 7. The reason is that any page with an iframe on it will never be cached, and will always be re-fetched.</p>
<p>The solution is iframe. So, we add this to views/foo/new.</p>
<p><code style="font-size:15px;"><span style="color:#99cc00;">&lt;iframe style="height:0px;width:0px;visibility:hidden" src="about:blank"&gt; this frame prevents back forward cache &lt;/iframe&gt;</span></code></p>
<p>This frame prevents back forward cache. And this works. Now we have cross-browser no-caching in a RESTful. Though this is a hack as Chad says. But it works for me. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/arjunghosh.wordpress.com/45/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/arjunghosh.wordpress.com/45/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arjunghosh.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arjunghosh.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arjunghosh.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arjunghosh.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arjunghosh.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arjunghosh.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arjunghosh.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arjunghosh.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arjunghosh.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arjunghosh.wordpress.com/45/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=45&subd=arjunghosh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://arjunghosh.wordpress.com/2008/04/29/how-to-force-the-browser-to-not-cache-in-rails/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4ea2c24103fcfd789efd9c16cd2d59b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arjunghosh</media:title>
		</media:content>
	</item>
		<item>
		<title>To make text in TextArea selectable onclick of mouse</title>
		<link>http://arjunghosh.wordpress.com/2008/04/28/to-make-text-in-textarea-selectable-onclick/</link>
		<comments>http://arjunghosh.wordpress.com/2008/04/28/to-make-text-in-textarea-selectable-onclick/#comments</comments>
		<pubDate>Mon, 28 Apr 2008 12:19:33 +0000</pubDate>
		<dc:creator>arjunghosh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://arjunghosh.wordpress.com/?p=46</guid>
		<description><![CDATA[I am very sure most know about this and is a very simple thing. But as I have found sometimes that small things are the one which are missed.
So wanted a quick note on &#8211; How to make the text inside a textarea selectable on mouse click.
Well, we use the Javascript event system 
[def: An [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=46&subd=arjunghosh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I am very sure most know about this and is a very simple thing. But as I have found sometimes that small things are the one which are missed.</p>
<p>So wanted a quick note on &#8211; How to make the text inside a textarea selectable on mouse click.</p>
<p>Well, we use the <a href="http://www.tizag.com/javascriptT/javascriptevents.php">Javascript event system</a> <strong></strong><br />
<strong>[def: An event in Javascript is something that happens with or on the web page ]</strong>.</p>
<p>Specifically we use the <strong><span style="color:#339966;">onclick Event</span></strong> to achieve the above stated goal. <span style="color:#339966;"><strong>onClick</strong></span> applies to buttons (submit, reset, and button), checkboxes, radio buttons, and form upload buttons.</p>
<p><strong>This is how we do it:</strong></p>
<blockquote><p><code style="font-size:15px;"><span style="color:#99cc00;">&lt;textarea rows="3" cols="43" name="none" onclick="this.select();"&gt;This is the text which when clicked on will get selected&lt;/textarea&gt;</span></code></p></blockquote>
<p>The main syntactic sugar here is the <span style="color:#339966;"><strong>&#8220;onclick=&#8221;this.select();&#8221;</strong></span></p>
<p>Here the <span style="color:#339966;"><strong>&#8220;this&#8221;</strong></span> helps us to access the textarea object and then we fire the <a href="http://www.w3.org/DOM/">DOM</a> event <span style="color:#339966;"><strong>&#8220;select()&#8221;<br />
</strong></span> dynamically on it, which in turns selects the text inside the textarea.<br />
ciao until next time <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/arjunghosh.wordpress.com/46/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/arjunghosh.wordpress.com/46/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arjunghosh.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arjunghosh.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arjunghosh.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arjunghosh.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arjunghosh.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arjunghosh.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arjunghosh.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arjunghosh.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arjunghosh.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arjunghosh.wordpress.com/46/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=46&subd=arjunghosh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://arjunghosh.wordpress.com/2008/04/28/to-make-text-in-textarea-selectable-onclick/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4ea2c24103fcfd789efd9c16cd2d59b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arjunghosh</media:title>
		</media:content>
	</item>
		<item>
		<title>How to Install Ruby, Rails 2.x, MySQL, SVN, then setup Rails 2.x Application, Configure the database, Run the Rake Tasks, Install plugins and, finally run RSpec for Models on your Local Windows System</title>
		<link>http://arjunghosh.wordpress.com/2008/04/25/how-to-install-ruby-rails-2x-mysql-svn-then-setup-rails-2x-application-configure-the-database-run-the-rake-tasks-install-plugins-and-finally-run-rspec-for-models-on-your-local-windows-system/</link>
		<comments>http://arjunghosh.wordpress.com/2008/04/25/how-to-install-ruby-rails-2x-mysql-svn-then-setup-rails-2x-application-configure-the-database-run-the-rake-tasks-install-plugins-and-finally-run-rspec-for-models-on-your-local-windows-system/#comments</comments>
		<pubDate>Fri, 25 Apr 2008 12:39:31 +0000</pubDate>
		<dc:creator>arjunghosh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[rail2.0]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rake]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[setup]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[TortoiseSVN]]></category>

		<guid isPermaLink="false">http://arjunghosh.wordpress.com/?p=44</guid>
		<description><![CDATA[A.) How to setup a Rails 2.x Application on your local system:&#8211;
[NOTE: The following steps are for Windows OS environment]

Setup Ruby and Rails      on the local system:-

Install Ruby       on Windows:
The easiest way is using the One-Click-Installer
Once the installation is complete, check that path to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=44&subd=arjunghosh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>A.) <span style="text-decoration:underline;">How to setup a Rails 2.x Application on your local system:&#8211;</span></strong><br />
<em>[NOTE: The following steps are for </em><strong><em>Windows OS</em></strong><em> environment]</em></p>
<ol type="1">
<li class="MsoNormal"><strong>Setup Ruby and Rails      on the local system:-</strong>
<ul type="circle">
<li class="MsoNormal"><strong>Install Ruby       on Windows:</strong><br />
The easiest way is using the <a href="http://rubyinstaller.rubyforge.org/wiki/wiki.pl?RubyInstaller">One-Click-Installer</a><br />
Once the installation is complete, check that path to ruby\bin directory       is in your <span class="caps">PATH</span> variable (Run “cmd”, then type       “path” at the prompt and check that the path is there.<br />
The great thing about the one-click installer is that it comes with Ruby       Gems, Scite pre-installed. The thing to watch out for is that one-click       installer does not have the very latest version of Ruby, so when you are       reading Ruby Docs, make sure you know which version of Ruby you have (run       <span style="color:#99cc00;"><strong>“ruby -v”</strong> </span>in the command prompt)</li>
<li class="MsoNormal"><strong>Installing       MySQL on Windows:</strong><br />
First, download and run the latest <a href="http://dev.mysql.com/downloads/">MySQL</a>. After the files are       unzipped, an Instance Config should run automatically (you can run it       manually at any time from your MySQL bin directory just run       “MySQLInstanceConfig.exe”). Then go through the step as directed.</li>
<li class="MsoNormal"><strong>Install Rails       on Windows:</strong><br />
Run the following command: <span style="color:#99cc00;"><strong>gem install rails –-include-dependencies</strong></span><br />
(If this command gives you an error, you do not have the latest version       of gems installed. Run “gem -v” to check for the version of RubyGems. It       should be 0.9.4. Otherwise, you may probably need to update RubyGems as       well.: <span> </span><span style="color:#99cc00;"><strong>gem       update &#8211;system</strong></span> <span> </span><span> </span><em><strong>[NOTE:       It is recommended that RubyGems version 0.9.4 is used as Rails 2.x had       some issue with version 0.9.5. Though this issue had been subsequently       resolved]</strong></em></li>
<li class="MsoNormal"><strong>Installing </strong><span class="caps"><strong>SVN</strong></span><strong> on Windows:</strong><br />
We use the <a href="http://tortoisesvn.net/downloads"><strong>TortoiseSVN</strong></a> SVN client on our local machine to use <span class="caps">SVN</span>.<br />
We have <span class="caps">SVN</span> version on our local system: <strong>1.4.3</strong><br />
The <span class="caps">SVN</span> version installed on the Server, which we       were using, can be found by running the command on the server: <span style="color:#99cc00;"><strong>svn       &#8211;version</strong></span></li>
</ul>
</li>
<li class="MsoNormal"><strong>Create a rails 2.x      application:-</strong><br />
SQLite3 is the new default database. So when a rails 2.x application is      created, by default the database support, which comes preconfigured, is      for SQLite3. So to create a rails 2.x application with MySql support      preconfigured, you simply need to run the following command: <strong>rails      -d mysql testapp</strong><br />
This will create the skeleton structure for the rails 2.x application with      mysql database adapter.</li>
<li class="MsoNormal"><strong>Configuring the      database for the application:-</strong><br />
Now a <em><strong>database.yml</strong></em> file is created in the <strong>/config</strong> under your application root folder. You need to set the <strong>development,      production and test database names</strong> there. Also you need to put in      the <strong>database password,if there exist any,</strong>So for your      database in this .yml file. This password is same as the one you put in      while installing mysql on your machine.</p>
<ul type="circle">
<li class="MsoNormal"><strong>So for a rails       application, </strong><strong><em>database.yml</em></strong><strong><strong> </strong>file configuration is       as follows:</strong><br />
<span style="color:#99cc00;"> development:<br />
database: testapp_development<br />
adapter: mysql<br />
encoding: utf8<br />
username: root<br />
password: mypassword</span> <em>[Note: password is set here if any]</em><br />
<span style="color:#99cc00;"> socket: /tmp/mysql.sock</span> <em><strong>[NOTE: Similarly for production and test       database]</strong></em></li>
</ul>
</li>
<li class="MsoNormal"><strong>To create the      database on the local machine:-</strong><br />
Run the following command: <span style="color:#99cc00;"><strong>rake db:create:all</strong></span><br />
The above command will create all the three database i.e. development,      production and test database as set in the <em><strong>database.yml</strong></em> file<br />
If you want to start from scratch, you can do <strong>rake db:drop:all</strong> And in the middle of development we can do <strong>rake db:rollback</strong> to undo the latest migration file.</li>
<li class="MsoNormal"><strong>To seed the database      with initial database:-</strong><br />
Run the following command: <span style="color:#99cc00;"><strong>rake db:populate</strong></span><br />
This will populated the database with initial data as written in populate      rake file. <strong>Also a rake task called rebuild</strong> has been      created so that it becomes easy to do the above steps from <strong>dropping      a db, re-creating the db,running all the migration and then finally      populating it with the initial seed data.</strong><br />
Run the following command:<span style="color:#99cc00;"><strong>rake db:rebuild</strong></span>. <strong>[NOTE:This      rebuild rake task will easily do all the above db related steps. See my previous post for <a href="http://arjunghosh.wordpress.com/2008/01/04/excellent-rake-task-code-snippet-to-completely-rebuild-migrate-your-db/" target="_blank"><span style="color:#339966;">&#8220;How to create a rake db:rebuild task&#8221;</span></a></strong></li>
<li class="MsoNormal"><strong>To run your Rails 2.x      application on the local system:-</strong><br />
Need to first go to root folder of your rails application. For example: <strong>F:/Projects/testapp/trunk </strong><br />
Then run the following command: <span style="color:#99cc00;"><strong>ruby script/server</strong></span><br />
This will run the application in <strong>development mode</strong>. To run      in production mode: <span style="color:#99cc00;"><strong>ruby script/server -e production</strong></span></li>
<li class="MsoNormal"><strong>To install rspec      plugin for rails application:-</strong><br />
Run the following commands at the command line:<strong><br />
<span style="color:#99cc00;"><strong>ruby script/plugin install      http://rspec.rubyforge.org/svn/tags/REL_1_1_3/rspec</strong><br />
<strong>ruby script/plugin install</strong></span> </strong><br />
and <span style="color:#99cc00;"><strong>http://rspec.rubyforge.org/svn/tags/REL_1_1_3/rspec_on_rails</strong></span><br />
Once the plugin is installed, you must bootstrap your palnglue rails app      with RSpec. Stand in the root of your Rails app and run: <span style="color:#99cc00;"><strong>ruby      script/generate rspec</strong></span><br />
This will generate the various files needed to use RSpec with Rails.</li>
<li class="MsoNormal"><strong>To run the rspec with      rake on the local machine:-</strong><br />
Run the following command at the root folder of the application: <span style="color:#99cc00;"><strong>rake      spec</strong></span><br />
or run specs with scripts/spec command: <span style="color:#99cc00;"><strong>ruby script/spec spec</strong></span></li>
</ol>
<p class="MsoNormal"><strong>B.) <span style="text-decoration:underline;">How to install a Plugin for Application:&#8211;</span></strong></p>
<p class="MsoNormal" style="margin-left:0.25in;">Stand in the root of your rails app and run:</p>
<p class="MsoNormal" style="margin-left:0.25in;"><span style="color:#99cc00;"><strong>ruby script/plugin install &lt;here the url path of the plugin to be installed&gt;</strong></span></p>
<p class="MsoNormal"><strong>C.) <span style="text-decoration:underline;">Running the RSpec test cases for Models:&#8211;</span></strong></p>
<p class="MsoNormal" style="margin-left:0.25in;">Run using the command:</p>
<p class="MsoNormal" style="margin-left:0.25in;"><span style="color:#99cc00;"><strong>rake spec:models</strong></span></p>
<p class="MsoNormal"><strong>D.) <span style="text-decoration:underline;">Running the RCov:&#8211;</span></strong></p>
<p class="MsoNormal" style="margin-left:0.25in;">Coverage tests can be run using the command:</p>
<p class="MsoNormal" style="margin-left:0.25in;"><span style="color:#99cc00;"><strong>rake spec:rcov</strong></span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/arjunghosh.wordpress.com/44/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/arjunghosh.wordpress.com/44/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arjunghosh.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arjunghosh.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arjunghosh.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arjunghosh.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arjunghosh.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arjunghosh.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arjunghosh.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arjunghosh.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arjunghosh.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arjunghosh.wordpress.com/44/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arjunghosh.wordpress.com&blog=1089418&post=44&subd=arjunghosh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://arjunghosh.wordpress.com/2008/04/25/how-to-install-ruby-rails-2x-mysql-svn-then-setup-rails-2x-application-configure-the-database-run-the-rake-tasks-install-plugins-and-finally-run-rspec-for-models-on-your-local-windows-system/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4ea2c24103fcfd789efd9c16cd2d59b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arjunghosh</media:title>
		</media:content>
	</item>
	</channel>
</rss>