<?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"
	>

<channel>
	<title>SitePoint Blogs &#187; Ruby on Rails</title>
	<atom:link href="http://www.sitepoint.com/blogs/category/tech/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sitepoint.com/blogs</link>
	<description></description>
	<pubDate>Mon, 13 Oct 2008 19:24:17 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>Timezones in Rails 2.1</title>
		<link>http://www.sitepoint.com/blogs/2008/10/06/timezones-in-rails-21/</link>
		<comments>http://www.sitepoint.com/blogs/2008/10/06/timezones-in-rails-21/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 14:00:44 +0000</pubDate>
		<dc:creator>madpilot</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>
<category>rails</category><category>ruby</category><category>timezones</category>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=3059</guid>
		<description><![CDATA[It isn't particularly surprising that timezone support is a pretty important component of web applications, as the web really is a global medium. If you are building an application that has to deal with times, timezone support can make your life vastly easier.]]></description>
			<content:encoded><![CDATA[<p>It isn&#8217;t particularly surprising that timezone support is a pretty important component of web applications, as the web really is a global medium. If you are building an application that has to deal with times, such as sending out calendar reminders or even something as simple as displaying a timestamp correctly, you may need to be wary of the fact that different users live in different timezones. Sound easy? Then read on&#8230;</p>
<p>A quick background lesson: Obviously, not every part of the world is in daylight at the same time, when it is the middle of the day in Australia, it&#8217;s the middle of the night in the United States. To make sure midday means the same thing in Perth as it does in Atlanta, the world is broken up in to timezones revolving around Coordinated Universal Time (UTC) that runs through Greenwich, UK (which is why UTC is also called Greenwich Mean Time or GMT), ranging from -12 GMT to +14 GMT. </p>
<p>Since every timezone is defined in respect to this imaginary zone time, it would make sense to use that as a base in our timezone coding adventure. In Rails, you can tell ActiveRecord to save all dates as UTC by setting the following value in your /config/environment.rb:</p>
<pre><code>
config.time_zone = 'UTC'
</code></pre>
<p>The most obvious and simple way to calculate localtime, would be to add the offset to the current time in GMT - and if that is all you needed to do, I could conclude this article right now, but alas, it&#8217;s not always that easy because of daylight savings.</p>
<div id="adz" class="vertical"></div><p>The theory behind daylight savings time (DST) is to shift the localtime forward an amount of time (usually an hour), making the sun seem to rise and set later, meaning you have more time to do stuff after work. Unfortunately, it just means you stay at work longer trying to work out all this timezone stuff. It wouldn&#8217;t be so bad if every country adopted DST on the same day, but the reality is that not all countries have it, each one adopts it at different times (in fact, it&#8217;s not uncommon for regions WITHIN a country to adopt it at different times), and not all countries advance it by a standard hour.</p>
<p>So what are we to do? Thankfully, there are a set of libraries called the zoneinfo database (or Olson database) that basically documents each and every DST transition for each country. The gem tzinfo is the Ruby version of this library, and before Rails 2.1, you would need to work with that library (maybe with the help of a plugin) to make timezones work, but now it is baked into Rails 2.1 and above.</p>
<p>The first step would be to store your users timezone information. The simplest way to do this is to store their timezone string against their user details, which I like to do using a grouped select tag:</p>
<pre><code>
&lt;select name="user[timezone]" id="user_timezone"&gt;
  &lt;%= option_groups_from_collection_for_select TZInfo::Country.all.sort, "zones", "name", "identifier", "friendly_identifier", @user ? @user.timezone : nil %&gt;
 &lt;/select&amp;gt
</code></pre>
<p>Which will save entries like &#8220;Australia/Melbourne&#8221; or &#8220;America/Los Angeles&#8221;. Next, you just need to tell Rails what timezone each request is in, which is now extremely simple using the Time.zone= method. Call this method in a before_filter in application.rb and it will set the timezone for each request:</p>
<pre><code>
def timezone_manager
  Time.zone = current_user.timezone if current_user &amp;&amp; current_user.timezone
end
</code></pre>
<p>Nice and easy! Every time you user or print out a timezone, it will be in the users local zone.</p>
<p>If you want to find out about more of the stuff you can do with the Rails 2.1 timezone support, check out the fantastic tutorial at: <a href="http://mad.ly/2008/04/09/rails-21-time-zone-support-an-overview/">http://mad.ly/2008/04/09/rails-21-time-zone-support-an-overview/</a></p>
<script src="http://ads.aws.sitepoint.com/adjs.php?region=136&amp;did=adz&amp;adtype=vertical" type="text/javascript"></script>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2008/10/06/timezones-in-rails-21/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Let&#8217;s get meta: missing method</title>
		<link>http://www.sitepoint.com/blogs/2008/07/11/lets-get-meta-missing-method/</link>
		<comments>http://www.sitepoint.com/blogs/2008/07/11/lets-get-meta-missing-method/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 13:29:42 +0000</pubDate>
		<dc:creator>madpilot</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2628</guid>
		<description><![CDATA[If you are coming from PHP, or C# you might not find yourself thinking in terms of meta programming - although both languages can do meta programming, it doesn&#8217;t seem to be heavily used. This isn&#8217;t the case in Ruby - quite the opposite - meta programming is a HUGE part of Ruby. 
So what [...]]]></description>
			<content:encoded><![CDATA[<p>If you are coming from PHP, or C# you might not find yourself thinking in terms of meta programming - although both languages can do meta programming, it doesn&#8217;t seem to be heavily used. This isn&#8217;t the case in Ruby - quite the opposite - meta programming is a HUGE part of Ruby. </p>
<p>So what is meta programming? It is basically a way of modifying programs dynamically, like adding or changing methods AFTER the program has started running (or at runtime as we like to call it).</p>
<p>A great example of this is the find_by_* methods in rails. If you have a model called &#8220;User&#8221; that has a column called &#8220;age&#8221; you can search your records by age using the magic method User.find_by_age. This is accomplished using the method_missing method.</p>
<p>If you call a method that doesn&#8217;t exist, Ruby will call the method_missing method, and pass the name of the method and any arguments you supplied, which means you can dynamically handle the method.</p>
<code><div id="adz" class="horizontal"></div><pre>
class MyClass
  def find(name, value)
    puts "You want results from #{name} with a value of #{value}"
  end

  def method_missing(id, *args)
    return self.find(Regexp.last_match(1),  args[0]) if id.id2name =~ /find_by_(.+)/
    raise NoMethodError
  end
end

m = MyClass.new
m.find('name', 'madpilot')
&gt; You want results from name with a value of madpilot
m.find_by_name('madpilot')
&gt; You want results from name with a value of madpilot
m.search_by_name('madpilot')
&gt; NoMethodError: NoMethodError
</pre>
</code>
<p>As you can see, there is definitely no &#8220;find_by_name&#8221; method, yet Ruby is smart enough to call the find method with the correct parameters. What we have done is to run a regular expression against the name of the method, and if it matches the pattern find_by_[string] then it calls the find method with the [string] part as the first parameter and the first argument as the second parameter. Pretty powerful, don&#8217;t you think?</p>
<p>Just a tip though - be careful of endless loops - if your method_missing method doesn&#8217;t terminate and you call a method that doesn&#8217;t exists inside method_missing, you&#8217;ll be in all sorts of trouble!</p>
<script src="http://ads.aws.sitepoint.com/adjs.php?region=137&amp;did=adz&amp;adtype=horizontal" type="text/javascript"></script>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2008/07/11/lets-get-meta-missing-method/feed/</wfw:commentRss>
		</item>
		<item>
		<title>This week in Rails. 30 June-04 July</title>
		<link>http://www.sitepoint.com/blogs/2008/07/09/this-week-in-rails-30-june-04-july/</link>
		<comments>http://www.sitepoint.com/blogs/2008/07/09/this-week-in-rails-30-june-04-july/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 14:01:47 +0000</pubDate>
		<dc:creator>madpilot</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>
<category>rails</category><category>ruby</category>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2597</guid>
		<description><![CDATA[I admit, Ruby&#8217;s Interpreter isn&#8217;t the fastest one around, and whilst there are alternative interpreters that are promising blazing speeds, there are thankfully some things you can do to speed up what we already have. igvita.com has a list of 6 Optimisation Tips for the Ruby MRI. There are a couple of surprising ones in [...]]]></description>
			<content:encoded><![CDATA[<p>I admit, Ruby&#8217;s Interpreter isn&#8217;t the fastest one around, and whilst there are alternative interpreters that are promising blazing speeds, there are thankfully some things you can do to speed up what we already have. <a href="http://igvita.com">igvita.com</a> has a list of <a href="http://www.igvita.com/2008/07/08/6-optimization-tips-for-ruby-mri/">6 Optimisation Tips for the Ruby MRI</a>. There are a couple of surprising ones in there.</p>
<p>Whilst on the topic of speed, using static pages for any pages that need to be, well, static is always a good idea. <a href="http://railscasts.com/">Railscast</a> has a new screen cast entitles <a href="http://railscasts.com/episodes/117">Semi-Static Pages</a>.</p>
<p>If are a Capistrano n00b, or you have been meaning to have a look at it, why don&#8217;t you join the <a href="http://weblog.jamisbuck.org/2008/7/7/online-capistrano-tutorial-session">Online Capistrano Tutorial Session</a>, held via Campfire next week. It will be on July 15 at 7pm MDT (what ever timezone that is) and will be given by Rails core-contributer <a href="http://weblog.jamisbuck.org/">Jamis Buck</a>. I&#8217;m personally intrigued as to how this will work, so I might even log in to check it out.</p>
<p>Until next time!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2008/07/09/this-week-in-rails-30-june-04-july/feed/</wfw:commentRss>
		</item>
		<item>
		<title>This week in Rails - 09/06 to 13/06</title>
		<link>http://www.sitepoint.com/blogs/2008/06/17/this-week-in-rails-0906-to-1306/</link>
		<comments>http://www.sitepoint.com/blogs/2008/06/17/this-week-in-rails-0906-to-1306/#comments</comments>
		<pubDate>Mon, 16 Jun 2008 14:24:06 +0000</pubDate>
		<dc:creator>madpilot</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>
<category>rails</category><category>ruby</category>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2551</guid>
		<description><![CDATA[It seems that testing has been on the flavour of the week, which is apt really as I myself have been playing with RSpec a lot lately (Blog post forthcoming, once I finish up one of the projects that has been using said testing framework).
Simon Harris from My hovercraft is full of eels describes a [...]]]></description>
			<content:encoded><![CDATA[<p>It seems that testing has been on the flavour of the week, which is apt really as I myself have been playing with <a href="http://rspec.info/">RSpec</a> a lot lately (Blog post forthcoming, once I finish up one of the projects that has been using said testing framework).</p>
<p>Simon Harris from <a href="http://www.redhillconsulting.com.au/blogs/simon/">My hovercraft is full of eels</a> describes a simple way to break up you tests into DRY, manageable chunks: <a href="http://www.redhillconsulting.com.au/blogs/simon/archives/000429.html">http://www.redhillconsulting.com.au/blogs/simon/archives/000429.html</a></p>
<p><a href="http://www.benmabey.com/">Ben Mabey</a> shows you how to use Macros in RSpec, using Shouda. Macros are as old as the hills, but can be really handy to organise many tasks simply: <a href="http://www.benmabey.com/2008/06/08/writing-macros-in-rspec/">http://www.benmabey.com/2008/06/08/writing-macros-in-rspec/</a></p>
<p><a href="http://gweezlebur.com/">Michael Ivey</a> reminds us why we should use tests. Not only are they a nice support net, but they encourage us to write better code. It&#8217;s like extreme programming without the other programmer: <a href="http://gweezlebur.com/2008/6/13/tests-make-you-write-better-code">http://gweezlebur.com/2008/6/13/tests-make-you-write-better-code</a></p>
<div id="adz" class="horizontal"></div><p>Outside of the testing arena, a new version of <a href="http://www.capify.org/">Capistrano</a> &#8212; possibly the coolest tool for Ruby &#8212; has been released. If you haven&#8217;t had a play with Capistrano yet, go and install it and try it out.</p>
<p>And finally for this week, if you have ever been perplexed about whether pieces of code belong in the Model, View or Controller, <a href="http://starjuice.net/">Starjuice</a> has an article that may give you a clue or two, so you can ensure you code is separated properly: <a href="http://starjuice.net/2008/6/model-view-or-controller">http://starjuice.net/2008/6/model-view-or-controller</a></p>
<script src="http://ads.aws.sitepoint.com/adjs.php?region=137&amp;did=adz&amp;adtype=horizontal" type="text/javascript"></script>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2008/06/17/this-week-in-rails-0906-to-1306/feed/</wfw:commentRss>
		</item>
		<item>
		<title>This week in Rails - new release edition</title>
		<link>http://www.sitepoint.com/blogs/2008/06/07/this-week-in-rails-new-release-edition/</link>
		<comments>http://www.sitepoint.com/blogs/2008/06/07/this-week-in-rails-new-release-edition/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 14:14:09 +0000</pubDate>
		<dc:creator>madpilot</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>
<category>rails</category><category>ruby</category>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2538</guid>
		<description><![CDATA[Rails 2.1 release
This week saw the release of of version 2.1 for Ruby on Rails. You can see the announcement on the official Rails blog.The new major features are:

Time zones (by Geoff Buesing)
Dirty tracking
Gem Dependencies:
	
Named scope (by Nick Kallen)
	
UTC-based migrations
	
Better caching

IronRuby runs Rails
The IronRuby team also announced this week that they managed to get a [...]]]></description>
			<content:encoded><![CDATA[<h2>Rails 2.1 release</h2>
<p>This week saw the release of of version 2.1 for Ruby on Rails. You can see the announcement on the <a href="http://feeds.feedburner.com/~r/RidingRails/~3/302144008/rails-2-1-time-zones-dirty-caching-gem-dependencies-caching-etc">official Rails blog</a>.The new major features are:</p>
<ul>
<li>Time zones (by Geoff Buesing)</li>
<li>Dirty tracking</li>
<li>Gem Dependencies:
	</li>
<li>Named scope (by Nick Kallen)
	</li>
<li>UTC-based migrations
	</li>
<li>Better caching</li>
</ul>
<h2>IronRuby runs Rails</h2>
<div id="adz" class="horizontal"></div><p>The IronRuby team also announced this week that they managed to get a &#8220;Hello World&#8221; example running on an unmodified Rails stack. Although it&#8217;s not yet ready for prime time, we are one step closer to being able to run Rails on .NET. See the announcement on <a href="http://www.iunknown.com/2008/05/ironruby-and-rails.html">Jon Lam&#8217;s blog</a>.</p>
<h2>RailsConf</h2>
<p><a href="http://en.oreilly.com/rails2008/public/content/home">RailsConf</a> was held in Portand this week. Unfortunately a trip to the US was stretching the budget a little, so if you were like me and unable to make it, check out Gregg Pollack&#8217;s video compilation of a number of interviews he had with some of the speakers. <a href="http://www.railsenvy.com/2008/6/2/Railsconf-videos">RailsConf in 36 Minutes</a>.</p>
<p>Until next time Railers!</p>
<script src="http://ads.aws.sitepoint.com/adjs.php?region=137&amp;did=adz&amp;adtype=horizontal" type="text/javascript"></script>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2008/06/07/this-week-in-rails-new-release-edition/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Did Rails Sink Twitter?</title>
		<link>http://www.sitepoint.com/blogs/2008/06/06/did-rails-sink-twitter/</link>
		<comments>http://www.sitepoint.com/blogs/2008/06/06/did-rails-sink-twitter/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 06:30:02 +0000</pubDate>
		<dc:creator>Kevin Yank</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2532</guid>
		<description><![CDATA[Twitter is arguably the most heavily used Ruby on Rails application in the world. Almost since its inception, Twitter has fostered a wildly passionate cult following. Also from the beginning, Twitter has suffered from chronic outages under that load.
In the past month, record downtime has prompted fresh outcry within its ever-growing user base. This, along [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.twitter.com/">Twitter</a> is arguably the most heavily used Ruby on Rails application in the world. Almost since its inception, Twitter has fostered a wildly passionate cult following. Also from the beginning, Twitter has suffered from chronic outages under that load.</p>
<p>In the past month, <a href="http://blog.twitter.com/2008/05/i-have-this-graph-up-on-my-screen-all.html">record downtime</a> has prompted fresh outcry within its ever-growing user base. This, along with increased attention from mainstream media has forced Twitter to publicly acknowledge these issues, and to reveal a few details about the source of these problems.</p>
<p>Though there has been much speculation about the source of Twitter’s performance issues, the closest we have had to a real peek under the hood has been <a href="http://dev.twitter.com/2008/05/twittering-about-architecture.html">this Twitter Developer Blog post</a>:</p>
<blockquote><p>Twitter is, fundamentally, a messaging system. Twitter was not architected as a messaging system, however. For expediency&#8217;s sake, Twitter was built with technologies and practices that are more appropriate to a content management system.</p></blockquote>
<div id="adz" class="vertical"></div><p>But wait, what exactly do they mean by “technologies and practices”? Could they mean Ruby on Rails?</p>
<h2>Twitter and the Curse of the Framework</h2>
<p>Ruby on Rails is a Model-View-Controller (MVC) framework. To build an application in Rails, you start by defining a collection of objects that model the things your application will do, then you write controllers that juggle your model in response to user requests, and finally you write the views that present your application to its users.</p>
<p>As separate as these three elements are, the performance of an app can depend largely on how they work together. If your model isn’t optimized for the way your controllers will use it, you could find yourself facing some surprising performance issues. This is the kind of problem that I expect Twitter is faced with.</p>
<p>Let’s look at a simplified example of what Twitter’s problem might look like on the inside.</p>
<p>Twitter is a site where users post short messages called Tweets, and follow the Tweets of other users. When the original developers behind the site first sat down to define their model, the simplest thing to do would have been to have a database table for all the Tweets, another table for all the users, and a third table to keep track of who is following whom.</p>
<p>This approach closely resembles the model you might build for a content management system (CMS) like a blog: each post has an author, so you can easily get a list of all the posts (i.e. Twitter’s <a href="http://twitter.com/public_timeline">public timeline</a>), or just the posts in a given category (e.g. <a href="http://twitter.com/sentience">my tweets</a>).</p>
<p>What this fails to take into account is the most common type of request that Twitter receives: show me the most recent tweets from just the users that I’m following. With a CMS-style model, this common request will generate a lot of work for the application, as it has to filter the timeline of Tweets for each individual user.</p>
<p><img src="http://sitepointstatic.com/blogs/wp-content/uploads/2008/06/twitter-as-cms.png" alt="Twitter as a CMS" border="0" width="507" height="256" /></p>
<p>If the original developers of Twitter had realised just how many requests of this type it would be fielding, Twitter’s model would probably have been designed very differently. As mentioned in the blog post quoted above, Twitter really is a messaging system, and its model should reflect that.</p>
<p>Here’s how the model of a messaging system might look: whenever a user posts a Tweet, the model looks up which users are following the author and places a copy of the Tweet into those users’ private timelines. Tweets are queued up for their recipients when they’re posted, shifting the processing burden away from the more common “show me my tweets!” request.</p>
<p><img src="http://sitepointstatic.com/blogs/wp-content/uploads/2008/06/twitter-as-msg.png" alt="Twitter as a messaging system" border="0" width="498" height="231" /></p>
<p>Now, let me be clear: both models could be built with Ruby on Rails. The CMS-style model is just the direction that the framework will lead you in if you don’t stop and think about the characteristics of your application. Any good framework will handle for you the things that most web applications have in common, so you can focus on the unique aspects of your app. The curse of the framework is that it can be very tempting to let the framework take the lead in handling those unique aspects too.</p>
<p>The fact is, Twitter’s developers were in a hurry, and took every opportunity to let the framework do the thinking for them. Just about every general-purpose web framework out there would have led them down the same road. “The fault, dear Brutus, is not in our stars, but in ourselves.” The message here is not that Rails is a bad framework—just that no framework can do the important thinking about how an app should work. That’s what developers are for.</p>
<p>Like any framework, Rails has strengths and weaknesses. Those who love Rails believe that its strengths—the virtual elimination of the scutwork of building web apps using a fresh, expressive programming language—far outweigh weaknesses like scaling being a non-trivial undertaking. Truth is, if you’re building a service intended for mass adoption and you don’t design it to support that, no framework in the world is going to keep your app from collapsing in on itself.</p>
<p><em>SitePoint’s new book, <a href="http://www.sitepoint.com/launch/7d1fc1">Simply Rails 2</a> is now available. <a href="https://sitepoint.com/bookstore/go/140/7d1fc1">Get it</a>, and build your own Twitter killer. :-)</em></p>
<script src="http://ads.aws.sitepoint.com/adjs.php?region=136&amp;did=adz&amp;adtype=vertical" type="text/javascript"></script>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2008/06/06/did-rails-sink-twitter/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Simply Rails 2: Your Rails 2 beginners book</title>
		<link>http://www.sitepoint.com/blogs/2008/06/02/simply-rails-2-your-rails-2-beginners-book/</link>
		<comments>http://www.sitepoint.com/blogs/2008/06/02/simply-rails-2-your-rails-2-beginners-book/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 11:55:07 +0000</pubDate>
		<dc:creator>ShayneTilley</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2527</guid>
		<description><![CDATA[The first edition was touted as the ultimate rails beginners book and read by 10’s of thousands of people. I’m pleased to announce a 2nd edition to Patrick Lenz’s brilliant book&#8230;
It&#8217;s called Simply Rails 2 and is available for purchase right now in PDF or Printed format at sitepoint.com. 
Grab the printed version for just [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sitepoint.com/book/rails2/"><img src="http://sitepoint.com/images/books/iso140.gif" alt="" class="imgright"/></a>The first edition was touted as the <a href="http://www.sitepoint.com/books/usercomment.php?p=rails1">ultimate rails beginners book </a>and read by <a href="http://www.sitepoint.com/forums/showthread.php?t=506517">10’s of thousands of people</a>. I’m pleased to announce a 2nd edition to Patrick Lenz’s brilliant book&#8230;</p>
<p>It&#8217;s called <strong><em><a href="http://www.sitepoint.com/books/rails2/">Simply Rails 2</a></em></strong> and is available for purchase right now in PDF or Printed format at sitepoint.com. </p>
<p>Grab the <a href="https://sitepoint.com/bookstore/go/140">printed version</a> for just $39.95 or the <a href="https://sitepoint.com/bookstore/go/141">PDF version</a> for just $29.95.</p>
<p>With <strong><em><a href="http://www.sitepoint.com/books/rails2/">Simply Rails 2</a></em></strong> you&#8217;ll learn how to build bulletproof Web applications from scratch, with more features using less code.</p>
<div id="adz" class="horizontal"></div><p>Patrick&#8217;s updated the entire book to take advantage of all the new Rails 2 features. It&#8217;s the only beginner&#8217;s book we know that&#8217;s Rails 2 ready&#8230;</p>
<p>Inside the book you&#8217;ll learn how to:</p>
<p>- Build and deploy your own Rails web application.<br />
- Reap the benefits of using best-practice MVC architecture.<br />
- Use Rails&#8217;s Ajax features to create slick interfaces.<br />
- Interact with databases easily using ActiveRecord.<br />
- Add the magic of REST to your apps with Rails Resources.<br />
- Use plugins to enhance your applications easily.</p>
<p><strong><em><a href="http://www.sitepoint.com/books/rails2/">Simply Rails 2</a></em></strong> will show you that there is a simple and easy way to build web 2.0 applications.</p>
<p><a href="https://sitepoint.com/bookstore/go/140">Grab yourself a copy today!</a></p>
<script src="http://ads.aws.sitepoint.com/adjs.php?region=137&amp;did=adz&amp;adtype=horizontal" type="text/javascript"></script>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2008/06/02/simply-rails-2-your-rails-2-beginners-book/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Rubinius runs Rails</title>
		<link>http://www.sitepoint.com/blogs/2008/05/19/rubinius-runs-rails/</link>
		<comments>http://www.sitepoint.com/blogs/2008/05/19/rubinius-runs-rails/#comments</comments>
		<pubDate>Mon, 19 May 2008 12:18:17 +0000</pubDate>
		<dc:creator>madpilot</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>
<category>rails</category><category>ruby</category>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2492</guid>
		<description><![CDATA[There was a short note today, that the Rubinius development team has successfully run Rails on their virtual machine. Although isn&#8217;t anywhere new production ready yet, it is a significant step forward in getting a faster Rails.
I covered some of the alternate Ruby implementations previously. 
Congratulations to the team!
]]></description>
			<content:encoded><![CDATA[<p>There was a <a href="http://blog.fallingsnow.net/2008/05/17/rails-on-rubinius/">short note today</a>, that the Rubinius development team has successfully run Rails on their virtual machine. Although isn&#8217;t anywhere new production ready yet, it is a significant step forward in getting a faster Rails.</p>
<p>I covered some of the <a href="http://www.sitepoint.com/blogs/2008/03/10/altruby/">alternate Ruby</a> implementations previously. </p>
<p>Congratulations to the team!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2008/05/19/rubinius-runs-rails/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Rails 2.1 release candidate 1 is on its way</title>
		<link>http://www.sitepoint.com/blogs/2008/05/15/rails-21-release-candidate-1-is-on-its-way/</link>
		<comments>http://www.sitepoint.com/blogs/2008/05/15/rails-21-release-candidate-1-is-on-its-way/#comments</comments>
		<pubDate>Wed, 14 May 2008 15:19:32 +0000</pubDate>
		<dc:creator>madpilot</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>
<category>rails</category><category>ruby</category>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2487</guid>
		<description><![CDATA[Word out on the wire is that Rails 2.1 RC1 has been tagged in the repository, so the gems should be available shortly. Being a point release, the changes aren&#8217;t major - mainly bug fixes and some performance improvements, but there are still some new features that will make it worth a look.
Updated timezone support
Timezones [...]]]></description>
			<content:encoded><![CDATA[<p>Word out on the wire is that Rails 2.1 RC1 has been tagged in the repository, so the gems should be available shortly. Being a point release, the changes aren&#8217;t major - mainly bug fixes and some performance improvements, but there are still some new features that will make it worth a look.</p>
<h2>Updated timezone support</h2>
<p>Timezones will finally become a first class citizen in Rails. You will be able to set the timezone, and all subsequent time calls will be with in that zone. </p>
<pre><code>
Time.zone = "Australia/Perth"
Time.zone.now # will return something like Wed, 24 May 2008 22:56:00 WST +08:00
</code></pre>
<h2>Better Gem dependencies</h2>
<p>If you rely on gems in any of your projects (and why wouldn&#8217;t you? Code re-use and all that), you may have come across the pain of gem versioning. Rails 2.1 will allow you to stipulate what versions of each gem you need. </p>
<div id="adz" class="horizontal"></div><pre><code>
config.gem "chronic", :version =&gt; '0.2.3'
</code></pre>
<p>It also adds a rake task that will automatically install the right gems for you.</p>
<pre><code>
rake gems:unpack
</code></pre>
<h2>Improved caching</h2>
<p>Previously, the only caching options Rails developers had was based around file fragments, which is fine for single server setups - but scaling that up to multiple servers could cause synchronisation issues, causing your cache to go stale. To combat this, you can now use a number of other shared caching systems including a memory store, drb store and a mem-cache store.</p>
<p>All very exciting stuff, and well worth a checking out. If you can download the beta gems by running the following from your trusty terminal window:</p>
<pre><code>
gem install rails –source http://gems.rubyonrails.com/
</code></pre>
<script src="http://ads.aws.sitepoint.com/adjs.php?region=137&amp;did=adz&amp;adtype=horizontal" type="text/javascript"></script>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2008/05/15/rails-21-release-candidate-1-is-on-its-way/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Smooth your deployment with Passenger</title>
		<link>http://www.sitepoint.com/blogs/2008/04/22/smooth-your-deployment-with-passenger/</link>
		<comments>http://www.sitepoint.com/blogs/2008/04/22/smooth-your-deployment-with-passenger/#comments</comments>
		<pubDate>Tue, 22 Apr 2008 13:40:16 +0000</pubDate>
		<dc:creator>madpilot</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>
<category>rails</category><category>ruby</category>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2443</guid>
		<description><![CDATA[I alluded to the release of Phusion&#8217;s Passenger (AKA mod_rails) - an Apache module that can run multiple Rails sites, just as PHP does. The significance of this is pretty huge. Up until now, running rails has required running Mongrel behind an Apache proxy or using FastCGI (or preferably fcgid). 
Although Mongrel did a sterling [...]]]></description>
			<content:encoded><![CDATA[<p>I alluded to the release of <a href="http://www.modrails.com/">Phusion&#8217;s Passenger</a> (AKA mod_rails) - an Apache module that can run multiple Rails sites, just as PHP does. The significance of this is pretty huge. Up until now, running rails has required running Mongrel behind an Apache proxy or using FastCGI (or preferably fcgid). </p>
<p>Although Mongrel did a sterling job, I have never been a big fan of having two points of failure - problems with either Apache or Mongrel would render your site unreachable. Not only that, adding capacity to your system required adding a number of mongrel instances, each with it&#8217;s own port and each with it&#8217;s own memory overhead, which can get very messy for shared hosting providers.</p>
<p>Passenger will allow hosting providers to install one Apache module, requiring the client to simply upload their application - no permission issues, or troublesome configurations files. However, it is also very useful for a developer - instead of having to run <code>script/server</code> when testing your application, you can install a local version of Apache, setup a few virtual hosts, and have instant access to your test sites.</p>
<p>Currently, Passenger only runs on *NIX type environments, eg Linux and OSX. The Phusion team have worked pretty hard to make the installation as simple as possible. Here are the basic steps:</p>
<div id="adz" class="horizontal"></div><ol>
<li>Install Apache (check with your vendor for instructions)</li>
<li>Run <code>gem install passenger</code></li>
<li>Run <code>passenger-install-apache2-module</code></li>
</ol>
<p>Passenger should now ask you a few questions, which if you answer correctly, should complete the installation.</p>
<p>Restart Apache and create a virtual host file, which points at your Rails application, and you are away! The following virtual host file will tell Apache to respond to the url http://test.localdomain with the Rails application in /home/sites/test.</p>
<code>
<pre>
&lt;VirtualHost 127.0.0.1:80&gt;
    ServerName test.localdomain
    DocumentRoot /home/sites/test
&lt;/VirtualHost&gt;
</pre>
</code>
<p>If you are using passenger for development, make sure your apache2.conf file has the line <code>RailsEnv development</code>.</p>
<script src="http://ads.aws.sitepoint.com/adjs.php?region=137&amp;did=adz&amp;adtype=horizontal" type="text/javascript"></script>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2008/04/22/smooth-your-deployment-with-passenger/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
