<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rails on the Run &#187; rails</title>
	<atom:link href="http://railsontherun.com/tag/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://railsontherun.com</link>
	<description>Rails experiments by Matt Aimonetti</description>
	<lastBuildDate>Tue, 23 Feb 2010 07:28:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Rails and Merb core team working together</title>
		<link>http://railsontherun.com/2008/12/24/rails-and-merb-core-team-working-together/</link>
		<comments>http://railsontherun.com/2008/12/24/rails-and-merb-core-team-working-together/#comments</comments>
		<pubDate>Wed, 24 Dec 2008 08:47:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[announcement]]></category>
		<category><![CDATA[merb]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2008/12/24/rails-and-merb-core-team-working-together</guid>
		<description><![CDATA[This is huge!

While people still try to find some drama an in hypothetical war between rails and merb.
The Rails team and the Merb team announced working together on a joined version of the 2 frameworks. This is so exciting, nobody believed it could ever happen (I personally, had my serious doubt).
Yehuda had a great post [...]]]></description>
			<content:encoded><![CDATA[<h3>This is huge!</h3>
<p><img class="alignright size-medium wp-image-385" title="surprise" src="http://merbist.com/wp-content/uploads/2008/12/surprise-296x300.jpg" alt="" width="296" height="300" /></p>
<p>While people still try to find some drama an in hypothetical war between rails and merb.</p>
<p>The Rails team and the Merb team announced working together on a joined version of the 2 frameworks. This is so exciting, nobody believed it could ever happen (I personally, had my serious doubt).</p>
<p>Yehuda had a great post laying down the plan and explaining things in details. Check out David’s post explaining why he wants us to work together and his vision of a better Ruby world.</p>
<p>I have to say that I have been impressed by the Rails core team and especially David (DHH).</p>
<p>I’ve known David for few years now and we had long/heated discussions on topics like i18n/l10n for Rails. David is known to be a very opinionated person. But if you come up with the right arguments, he can be convinced and when that happens, he is willing to move forward and shake things up.</p>
<p>This merge is a concrete example that David and the rest of the Rails team cares about Rails and the Ruby community more than we usually give them credit for. As a unified team, we are going to change the way web development in Ruby is done!</p>
<p>But what does it mean for you?</p>
<p>I put together a FAQ video here is the transcript:</p>
<p>Hi, I’m Matt Aimonetti from the merb core team and as you might have heard, a big announcement was made earlier today.</p>
<p>I did this video to hopefully answer the questions you might have.</p>
<h3>Q: So what’s the big news?</h3>
<ul>
<li>merb and rails team will work together on the next version of their frameworks</li>
<li>merb 2.0 and rails 3.0 share the same common endpoint</li>
<li>we realized we now have the same objectives and agreed on all the key principles.</li>
<li>merb will provide Rails with agnosticism, modularity, improved performance and a public API.</li>
<li>The end product will be called Rails 3.0 but what real matters is that it’s a huge gain for the entire community.</li>
</ul>
<h3>Q: What??? I thought there was a war going on between Rails and merb, what happened?</h3>
<ul>
<li> There was no war between rails and merb</li>
<li> We created merb because rails was not fitting us</li>
<li> We wanted better performance, more choices/ more modularity and a Public API.</li>
<li> The Rails team now embraces these concepts and want Rails to follow them, so why not work together?</li>
</ul>
<h3>Q: Wait, does that mean that merb is dead?</h3>
<ul>
<li> Absolutely not!</li>
<li> merb development won’t stop, we are going to keep on releasing updates until rails 3.0</li>
<li> clear migration path, and upgrading to rails 3.0 will be as trivial as upgrading from rails 2.x to Rails 3.0</li>
</ul>
<h3>Q: What does the timeline look like?</h3>
<p>We just started getting together and discuss the technical details. We are shooting for a release at RailsConf 2009. However it’s hard to estimate this kind of things so again, that’s just an estimate <img class="wp-smiley" src="http://merbist.com/wp-includes/images/smilies/icon_smile.gif" alt=":)" /></p>
<h3>Q: I just started a merb project, so what now?</h3>
<p>I’m sure you had valid reasons to use merb, you needed modularity, performance and a solid API.</p>
<p>Keep on using Merb, we won’t let you down. The good news is that the next version of merb (rails 3.0) will be even awesomer!</p>
<h3>Q: What about my client who was looking at using merb for his new project?</h3>
<p>If your client is going to be using merb for valid reasons (and not, just because it’s not rails) he should still use merb, but with the full understanding that he/she will end up using Rails in 6 months or so. Again, Rails 3.0 will have what pushed you to use merb.</p>
<h3>Q: I’ve been involved with the merb-book, what will happen with this project?</h3>
<ul>
<li> rails 3.0 won’t get released right away</li>
<li> still need awesome documentation</li>
<li> if we look at rails 3.0 as merb 2.0, we can easily imagine how the current work can be extended to the new version.</li>
<li> rails team will also include an evangelism team which I will be part of, so will be able to focus more on projects like the book.</li>
</ul>
<h3>Q: I’ve been working on a merb plugin, what should I do?</h3>
<p>Keep working on it! We’ll assist you with the migration process and the new solid API.</p>
<h3>Q: What if I still have questions?</h3>
<p>Come talk with me, or any members from the new team. We’ll be open to hear your questions, worries, frustrations.</p>
<p>merb always valued its developers and we will continue to do so but at a bigger scale.</p>
<hr />Concretely, nothing changes for Merb users. People loving Merb should not worry. The way you build merb apps won’t change until merb2.0/rails3.0. We will still work on your favorite framework and improve it.</p>
<p>Lori Holden worked on merb_sequel and we should release a 1.0 release of the plugin in a few days.</p>
<p>I’m sure this news comes as a shock for many of you, but try to not see Rails 3.0 as the way Rails is right now. Imagine a version of Rails with true modularity and agnosticism (sequel, DM and AR will still be supported) and the same type of performance as what you get with Merb. In other words, the rails world is about to discover the power of merb!</p>
<p>Here is what Yehuda explicitly says in his blog post:</p>
<ul>
<li>Rails will become more modular, starting with a rails-core, and including the ability to opt in or out of specific components. [...]</li>
<li>We will port all of our performance improvements into Rails. This includes architectural decisions that are big performance wins.[..]</li>
<li>As of Rails 3, Rails will have a defined public API with a test suite for that API. [..]</li>
<li>Rails will still ship with the “stack” version as the default (just as Merb does since 1.0), but the goal is to make it easy to do with Rails what people do with Merb today.</li>
<li>Rails will be modified to more easily support DataMapper or Sequel as first-class ORMs. [..]</li>
<li>Rails will continue their recent embrace of Rack, which [..] will improve the state of modular, sharable logic between applications.</li>
<li>In general, we will take a look at features in Merb that are not in Rails (the most obvious example is the more robust router) and find a way to bring them into Rails.</li>
</ul>
<h2>Personal perspective</h2>
<p>I’m personally really excited about this opportunity. I had a hard time believing that we could work together but I was proved wrong. We have many challenges in front of us, but watching the two teams working together is very reassuring.</p>
<p>I’m also glad to see that we will have a Rails Evangelism team that I will be part of. I strongly believe that one of the many reasons why merb has been so successful is because we work and listen to our community. We have put a tremendous amount of energy trying to understand what you guys need and what you like and dislike. In return, we saw many people working hard on the wiki and the merb-book.</p>
<p>Can you imagine doing that with almost 4 Million Rails developers?</p>
<p>I’m also looking forward to working with a team and reaching to even more people.</p>
<h2>Other news related to the merge:</h2>
<ul>
<li>The RubyOnRails website will keep a trace of this historical moment: <a href="http://rubyonrails.org/merb" target="_blank">http://rubyonrails.org/merb</a></li>
<li>The <a href="http://merbclass.com/" target="_blank">merb training scheduled for Jan 19-21</a> in partnership with <a href="http://integrumtech.com/" target="_blank">Integrum</a> will still take place, and if you want to get a head start and learn about the things that will make Rails 3.0 totally kick ass, I’d suggest you join us.</li>
</ul>
<p>If you have any questions, or if you want me to publicly answer questions on your blog please contact me. I’ll do my best to get back to everyone.</p>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2008/12/24/rails-and-merb-core-team-working-together/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ruby developers don&#8217;t scale</title>
		<link>http://railsontherun.com/2008/08/27/ruby-developers-don-t-scale/</link>
		<comments>http://railsontherun.com/2008/08/27/ruby-developers-don-t-scale/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 14:58:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[client]]></category>
		<category><![CDATA[developers]]></category>
		<category><![CDATA[merb]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2008/08/27/ruby-developers-don-t-scale</guid>
		<description><![CDATA[Wow, it&#8217;s been a while since I blogged. With all the cool kids saying that spending time reading RSS feeds is overrated (see Defunkt&#8217;s keynote for instance) I even wonder if people will ever read this post!
Anyways, I have been quite busy preparing courses for classes I gave to a bunch a great Engineers at [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, it&#8217;s been a while since I blogged. With all the cool kids saying that spending time reading RSS feeds is overrated (see <a href="http://rubyhoedown2008.confreaks.com/08-chris-wanstrath-keynote.html">Defunkt&#8217;s keynote</a> for instance) I even wonder if people will ever read this post!</p>
<p>Anyways, I have been quite busy preparing courses for classes I gave to a bunch a great Engineers at one of the Fortune 100 companies based in San Diego. I was also planning my big vacation trip to Europe and wrapping up few projects.</p>
<p>However, during my exile overseas, I came to the conclusion that <strong>Rubyists don&#8217;t scale</strong>. Since Twitter became stable again, we don&#8217;t hear many people ranting about Rails not scaling anymore.  With one of my clients&#8217; app handling around <strong>7 million requests/day</strong> I can tell you <strong>Ruby/Merb do scale quite well</strong>! But ruby developers don&#8217;t seem to scale for some reason.</p>
<p>Maybe saying that we(Rubyists) don&#8217;t scale isn&#8217;t technically correct but that&#8217;s basically what one of my client told me.</p>
<p>Let&#8217;s go back in time a little bit and follow my client who we will call clientX. </p>
<ul>
<li>ClientX has a <strong>great concept</strong> and wants to conquer the internet.</li>
<li>ClientX hears that <strong>Rails is the way to go</strong>.</li>
<li>ClientX hires a contractor/mercenary/freelancer/guns for hire/<strong>consultant</strong> (aka Me)</li>
<li>
<p>Me builds a <strong>killer app</strong> using <strong>Merb</strong> (killing framework)</p>
</li>
<li>
<p>ClientX raises loads of <strong>$$$</strong></p>
</li>
<li>
<p>ClientX <strong>wants to hire a team</strong> because Me doesn&#8217;t want to become a FTE</p>
</li>
<li>ClientX and Me <strong>look for Rubyists</strong> wanting to relocate and get a decent salary</li>
<li>
<p>ClientX <em>*can&#8217;t find someone</em> they consider good enough and who would accept their package</p>
</li>
<li>
<p>Many <strong>JAVA guys are available</strong> on location and accept lower packages</p>
</li>
<li><strong>Ruby app gets ported over to JAVA</strong></li>
<li><strong>Me sad</strong> <img src='http://railsontherun.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </li>
</ul>
<p>So is it really the Rubyists&#8217; fault if we don&#8217;t want to relocate and only accept higher packages? Should I blame <a href="http://blog.obiefernandez.com/">Obie</a> for telling people to charge more and teaching how to <a href="http://rubyhoedown2008.confreaks.com/07-obie-fernandez-do-the-hustle.html">hustle</a>? Or should we just tell clients that it&#8217;s time to get used to working remotely?</p>
<p>Honestly, I don&#8217;t think any of the above explanations are valid. Ruby is the new/hot technology and very few people have the skills and experience to lead major projects. These people make a good living and enjoy their &#8220;freedom&#8221; and dream of building their own products. Most of them/us value their work environment, family and are reluctant to move.</p>
<p><img src="http://img.skitch.com/20080827-rwca7tfprhce6hw19uytfqx1bc.jpg" alt="scale"/></p>
<p>At the same time, companies do need people locally(at least a core team) and can&#8217;t always afford the cool kids. </p>
<p>ClientX, quite frustrated by the whole hiring process told me once: <strong>&#8220;you Ruby folks are too unavailable and difficult to work with! We need a committed team that actually cares about the company/product.&#8221;</strong></p>
<p>That hurts when you worked hard on a project and just can&#8217;t satisfy the client by finding guys willing to relocate and work for them. <strong>It gets even more painful when your code gets entirely ported over to JAVA!</strong></p>
<p>But at the same time I understand ClientX&#8217;s motivation, PHP guys are cheaper, JAVA guys are more available, why in the word did we go with Ruby and are now struggling finding people?</p>
<p>Once again, there is positive and negative side in everything, by choosing Ruby and a &#8220;great contractor&#8221; ClientX was able to <strong>catch up with the competition and even pass them in no time</strong>. They quickly raised good money and got everything they needed to become #1. I don&#8217;t believe it would have been possible to do the same thing so quickly with JAVA for instance. However choosing a cutting edge technology means you need to look harder for talented people.</p>
<p>It&#8217;s too bad the code gets rewritten in a different language but at the same time, I do my best to facilitate the process and to keep a good relation with my client. There was nothing personal in the decision, it&#8217;s just too bad we were not able to keep on using the latest/coolest/awesomess technology available <img src='http://railsontherun.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>To finish on a positive note, here is the solution to scale your Ruby task force provided to you by the #caboose wisdom:</h2>
<p>Based on my conversations with other #caboosers who hire other devs, the word in the street is that you just need to get one or two great ruby guys (who will probably cost you a lot) and find a bunch of smart people to train. You&#8217;ll end up with an awesome team of scalable rubyists <img src='http://railsontherun.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2008/08/27/ruby-developers-don-t-scale/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>News update</title>
		<link>http://railsontherun.com/2008/06/18/news-update/</link>
		<comments>http://railsontherun.com/2008/06/18/news-update/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 01:40:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[conf]]></category>
		<category><![CDATA[merb]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2008/06/18/news-update</guid>
		<description><![CDATA[I realized I haven&#8217;t updated this blog in a while. Here is a quick update on what&#8217;s happened and on things to come:


RailsConf 08. Great conference, probably my last Rails Conf though. I&#8217;ll be in Orlando for Ruby Conf 08 and I&#8217;ll focus on 1 or 2 local conferences (probably mountain west and another one).


MerbCamp [...]]]></description>
			<content:encoded><![CDATA[<p>I realized I haven&#8217;t updated this blog in a while. Here is a quick update on what&#8217;s happened and on things to come:</p>
<ul>
<li>
<p><a href="http://en.oreilly.com/rails2008/public/content/home">RailsConf 08</a>. Great conference, probably my last Rails Conf though. I&#8217;ll be in Orlando for <a href="http://rubyconf.org/">Ruby Conf 08</a> and I&#8217;ll focus on 1 or 2 local conferences (probably <a href="http://mtnwestrubyconf.org/">mountain west</a> and another one).</p>
</li>
<li>
<p>MerbCamp 08 in San Diego this Fall organized by <a href="http://sdruby.com">SD Ruby</a>. Details are not finalized yet but <a href="http://yehudakatz.com/">Yehuda Katz</a> announced it during his Merb talk at RailsConf.</p>
</li>
<li>
<p>Moved this blog to a new <a href="http://joyent.com">Joyent accelerator</a> with git support and finally have the possibility to use Ambition! (planning on moving from Mephisto to <a href="http://crazycool.co.uk/2008/04/26/announcing-feather">Feather</a>)</p>
</li>
<li>
<p>Launched a client&#8217;s Merb app and getting around 3 million hits/day. Merb is just awesome. (more info when the client&#8217;s app gets out of beta)</p>
</li>
<li>
<p>I&#8217;ll join <a href="http://railsenvy.com/">Gregg Pollack</a> from <a href="http://railsenvy.com/">http://railsenvy.com/</a> during <a href="http://qcon.infoq.com">Qcon</a> and take part in the <a href="http://qcon.infoq.com/sanfrancisco-2008/tracks/show_track.jsp?trackOID=172">Ruby for the Enterprise</a> track. <a href="http://qcon.infoq.com/sanfrancisco-2008/speaker/Matt+Aimonetti">My talk</a> will focus on Merb usage in real life.</p>
</li>
<li>
<p>Renamed my github username, new repo url: <a href="http://github.com/mattetti">http://github.com/mattetti</a> (sorry about that)</p>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2008/06/18/news-update/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Rails or Merb, what&#8217;s best for you?</title>
		<link>http://railsontherun.com/2008/04/10/rails-or-merb-what-s-best-for-you/</link>
		<comments>http://railsontherun.com/2008/04/10/rails-or-merb-what-s-best-for-you/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 08:10:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[merb]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2008/04/10/rails-or-merb-what-s-best-for-you</guid>
		<description><![CDATA[
If you follow my blog, you already know what Merb is.
I love Rails and I truly believe it has changed web development. At least it has changed the way I do web development. 
But Merb looks slick, apparently is way faster than Rails, and has less &#8220;fluff&#8221; and less magic. 
Now that we are getting [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://brainspl.at/louiecon.gif" alt=""/></p>
<p>If you follow my blog, you already know what <a href="http://merbivore.com">Merb</a> is.</p>
<p>I love Rails and I truly believe it has changed web development. At least it has changed the way I do web development. </p>
<p>But Merb looks slick, apparently is way faster than Rails, and has less &#8220;fluff&#8221; and less magic. </p>
<p>Now that we are getting really close to a Merb 1.0 (scheduled for Rails Conf &#8216;08) it&#8217;s time to evaluate if Merb is the good choice for some of my clients&#8217; projects.</p>
<p>However, according to Merb&#8217;s author, Ezra, at MountainWest RubyConf 2008, <a href="http://mwrc2008.confreaks.com/02zygmuntowicz.html">Rails will get you there faster</a>. In a client&#8217;s case, they don&#8217;t need to build a huge app but need a lot of speed and the ability to easily handle a heavy load right away without using caching. Also most of the traffic will go through an API so we won&#8217;t have to manage too many views.</p>
<h2>Let&#8217;s see how fast Merb really is.</h2>
<p>To test Merb&#8217;s speed, I built the very same prototype using Merb 0.9.2 and Rails Edge (pre 2.1). Both apps use ActiveRecord and are connected to a UTF8 MySQL database, both apps have exactly the same views. (Note that Merb would run way faster using DataMapper, but I don&#8217;t feel that DM 0.9x is production ready yet, also, using a rack handler would certainly be way faster but my goal was really to compare ActionPack vs Merb.)</p>
<p>Both apps use the same ActiveRecord class, their controllers are a bit different but basically do the same thing.</p>
<p>Here is what was tested:</p>
<ul>
<li>
<p>The Merb/Rails app should receive a GET request with a JSON object in the query. </p>
</li>
<li>
<p>The Merb/Rails app should route the request to a controller and pass the JSON object to an AR class.</p>
</li>
<li>
<p>The AR class should parse the JSON object (which contains an array of objects), extract each object, and try to find them in the database using one of the attributes. If the object isn&#8217;t found, it should be created, otherwise it should return the AR object. The amount of hits should be incremented by 1 and the object should be saved back to the database.</p>
</li>
<li>
<p>A simple HTML view should be rendered</p>
</li>
</ul>
<h2>Quick Merb benchmark</h2>
<p><img src="http://merbivore.com/img/header_logo.png" alt="merb"/></p>
<p>I setup Merb to run locally on my MacBook 2.16Ghz Core Duo 2, 2Gb Ram. To test the raw performance, Merb is started in production mode.</p>
<p>I then used httperf to make 10000 connections to the server at a rate of 500 (&#8211;rate=500 &#8211;send-buffer=4096 &#8211;recv-buffer=16384 &#8211;num-conns=10000 &#8211;num-calls=1)</p>
<p>Here are the results:</p>
<pre><code>Maximum connect burst length: 29
Total: connections 4377 requests 4221 replies 2932 test-duration 41.629 s
Connection rate: 105.1 conn/s (9.5 ms/conn, &lt;=1022 concurrent connections)
Connection time [ms]: min 41.0 avg 1920.4 max 35390.8 median 898.5 stddev 4887.3
Connection time [ms]: connect 2118.1
Connection length [replies/conn]: 1.000

Request rate: 101.4 req/s (9.9 ms/req)
Request size [B]: 321.0

*Reply rate [replies/s]: min 0.0 avg 73.3 max 143.0 stddev 65.8 (8 samples)*
Reply time [ms]: response 809.0 transfer 18.1
Reply size [B]: header 121.0 content 557.0 footer 0.0 (total 678.0)
*Reply status: 1xx=0 2xx=2932 3xx=0 4xx=0 5xx=0*

CPU time [s]: user 0.35 system 36.54 (user 0.8% system 87.8% total 88.6%)
Net I/O: 78.4 KB/s (0.6*10^6 bps)

Errors: total 7068 client-timo 0 socket-timo 0 connrefused 0 connreset 1445
Errors: fd-unavail 5623 addrunavail 0 ftab-full 0 other 0
</code></pre>
<p>What we care about is the reply rate/s. We have an average of <em>73.3 requests per second</em> with a standard deviation of 65.8 using 8 samples.</p>
<p>We also make sure that all the replies were successful. (status == 2xx)</p>
<p>I also checked the database, made sure my AR object was created and that the hits were increased. AR object hits: 2932, which matches the amount of replies reported by httperf.</p>
<p>We don&#8217;t care so much about the rest of the httperf. Let&#8217;s move on to the Rails benchmark.</p>
<hr/>
<h2>Quick Rails benchmark</h2>
<p><img src="http://www.rubyonrails.org/images/rails.png" alt="rails"/></p>
<p>Rails is set the same way, running locally in production mode, same httperf settings.</p>
<p>Here are the results:</p>
<pre><code>Maximum connect burst length: 44

Total: connections 2923 requests 2825 replies 1672 test-duration 37.418 s

Connection rate: 78.1 conn/s (12.8 ms/conn, &lt;=1022 concurrent connections)
Connection time [ms]: min 382.7 avg 5635.4 max 36384.5 median 1887.5 stddev 10103.1
Connection time [ms]: connect 3631.2
Connection length [replies/conn]: 1.000

Request rate: 75.5 req/s (13.2 ms/req)
Request size [B]: 319.0

*Reply rate [replies/s]: min 0.0 avg 43.4 max 75.2 stddev 30.8 (7 samples)*
Reply time [ms]: response 1568.1 transfer 36.7
Reply size [B]: header 471.0 content 581.0 footer 0.0 (total 1052.0)
*Reply status: 1xx=0 2xx=1672 3xx=0 4xx=0 5xx=0*

CPU time [s]: user 0.25 system 31.31 (user 0.7% system 83.7% total 84.4%)
Net I/O: 69.4 KB/s (0.6*10^6 bps)

DB hits: 1672
</code></pre>
<p>First thing, the database object was created properly and the hits incremented to 1672 which matches the amount of replies reported by httperf.</p>
<p>Then, we notice that on this test, we only got 7 samples, that&#8217;s more than enough though. The standard deviation is 30.8 which is better than Merb&#8217;s 65.8. That means that in our benchmarks, the reply speed difference in Merb&#8217;s requests was bigger than Rails&#8217;. Not a big deal, this is not a scientific test but it&#8217;s good to acknowledge it.</p>
<p>What we really care about is the average reply rate: 43.4</p>
<p>Let&#8217;s also note that all the replies had a 2xx status, so everything went well.</p>
<h2>Results</h2>
<p>Based on this really basic benchmark, my Merb app had an average reply rate of <em>73.3 requests per second</em> against Rails&#8217; <em>43.4 requests per second</em>.</p>
<p>That means that in this very specific case, </p>
<h2><em>Merb is 69% faster than Rails</em>!  Sexy! </h2>
<p>In other words, my Merb prototype could handle 69% more requests than the Rails prototype in the same amount of time.</p>
<p>I heard people reporting than Merb was 3 to 5 times faster than Rails. Honestly, it really depends on what you do. By using ActiveRecord on both prototypes, I limited the speed difference since AR is not multithread and therefore Merb can&#8217;t run as fast as it would using Sequel or DataMapper. By actually hitting the database on every single request, I also made sure to really compare ActionPack vs Merb.</p>
<h2>Conclusion</h2>
<p>The conclusion is simple, I recommended that my client go with Merb. Merb 1.0 is almost ready, the public API has been frozen. My client needs speed and simplicity. Using Merb I get exactly what I need and nothing more. Actually, we&#8217;ll probably increase the performance by writing a rack handler and bypassing the entire framework for API calls (that should be wicked fast!).  Also, as soon as DataMapper becomes production ready, we&#8217;ll switch to DM and should get way better performance!</p>
<p>Am I suggesting to give up Rails and switch to Merb?<br />
Absolutely not!  First off, Merb is a &#8220;lower level&#8221; framework. It requires a deeper understanding of Web Development in general and being more than just &#8216;acquainted&#8217; with the Ruby language. So, unless you are an advanced developer or have time to learn, I would suggest to keep on using Rails (start using Merb on personal projects, it&#8217;s a perfect way of learning).<br />
If you have a lot of views and/or use loads of AJAX, RJS, built-in helpers, you probably want to stick to Rails and start looking at how you can do all of that from scratch. By default Rails uses nasty helpers that create inline javascript, and is something you really want to avoid. RJS is fun, but it goes against Merb&#8217;s philosophy, so you need to make sure you can live without it (note that you can reproduce the same behavior in Merb rendering JS, it just requries more work). If you rely a lot of Rails plugins, you might want to delay your switch, Merb is pretty new and doesn&#8217;t have a mass-load of plugins yet.</p>
<p>Finally, Merb doesn&#8217;t have a lot of documentation and changed a lot when 0.9 got released. To understand how Merb works, you will need to go through the source code, specs, Google, and ask on the Merb IRC channel.</p>
<p>It turns out that in our case we have experienced developers, a great need for speed, not too many views and are following Merb&#8217;s development really closely . I honestly think it&#8217;s the best choice for my client and I&#8217;m excited they accepted to use Merb.</p>
<p>Merb is addressing different issues than Rails and doing it well. I think there is a bright future for Merb. And don&#8217;t even think that Rails is going away, that won&#8217;t happen anytime soon! </p>
<p>Recently, <a href="http://www.us.playstation.com/Corporate/About">Sony Playstation</a> even posted a <a href="https://www2.recruitingcenter.net/Clients/playstation/PublicJobs/controller.cfm?jbaction=JobProfile&amp;Job_Id=11424&amp;esid=az">job post</a> looking for a Rails/Merb developer. This is very promising for the Merb community!</p>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2008/04/10/rails-or-merb-what-s-best-for-you/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>How Duplo (and I) offended people</title>
		<link>http://railsontherun.com/2008/03/21/how-duplo-and-i-offended-people/</link>
		<comments>http://railsontherun.com/2008/03/21/how-duplo-and-i-offended-people/#comments</comments>
		<pubDate>Fri, 21 Mar 2008 06:59:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[duplo]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2008/03/21/how-duplo-and-i-offended-people</guid>
		<description><![CDATA[My recent and certainly provocative post generated a lot of noise. Just by reading some of the comments on my blog or on reddit I could only notice that some people took offense and some people tried to push the metaphor way too far. At the same time, it generated a lot of interesting discussions [...]]]></description>
			<content:encoded><![CDATA[<p>My <a href="http://railsontherun.com/2008/3/17/rails-the-duplo-generation">recent and certainly provocative post</a> generated a lot of noise. Just by reading some of the <a href="http://railsontherun.com/2008/3/17/rails-the-duplo-generation#comments">comments</a> on my blog or on <a href="http://reddit.com/r/ruby/info/6cbwo/comments/">reddit</a> I could only notice that some people took offense and some people tried to push the metaphor way too far. At the same time, it generated a lot of interesting discussions even <a href="http://msforums.ph/forums/p/47347/226547.aspx">outside</a> of our <em>small</em> Ruby community.</p>
<h2>A few clarifications:</h2>
<ul>
<li>
<p>Rails is an awesome framework, and to be honest I really like the fact that it&#8217;s accessible to newbies while offering great tools</p>
</li>
<li>
<p>Rails Plugins that I like calling Duplo blocks are great and I use a bunch in most of my projects</p>
</li>
<li>
<p>I, myself wrote a bunch of <a href="http://github.com/matta/">plugins and gems</a> never as great as the one mentioned in <a href="http://railsontherun.com/2008/3/17/rails-the-duplo-generation">my post</a> though</p>
</li>
<li>
<p>No, I don&#8217;t think you are dumb if you don&#8217;t have a clue how Rails or Rails plugins work</p>
</li>
</ul>
<p>I also agree that the <img src="http://cache.lego.com/upload/contentTemplating/LifestyleProductsBags/otherfiles/1033/uploadF2767709-6EFA-4D99-93FA-13F75766309B.jpg" alt="Duplo"/> metaphor is very limited and doesn&#8217;t stretch&#8230; but who cares.. it&#8217;s funny.</p>
<h2><em>What did I mean to say</em></h2>
<ul>
<li>
<p>Rails plugins are useful, use them and <em>ABUSE</em> them. Even though most of them are very well written I strongly believe you would become a better developer if you understand how they work.</p>
</li>
<li>
<p>A <em>Duplo</em> doesn&#8217;t do exactly what you want it to do, don&#8217;t <em>bitch</em> about it. Try submitting a patch or if you can write your own plugin.</p>
</li>
<li>
<p>If you are using a plugin on a regular basis, give it some love. Submit some documentation, write a blog post, send a thank you email.</p>
</li>
<li>
<p>A great framework and a bunch of nice plugins are awesome tools for developers but they won&#8217;t replace your brain.</p>
</li>
</ul>
<p>So, there you go, this time around I tried to be more straight forward and I even apologize if I offended you.</p>
<p>Finally, I don&#8217;t believe the Rails community is a bunch of <em>obnoxious-arrogant-wannabe-rockstars</em>, and certainly not a ghetto. We all started as newbies and I hope a lot of newbies will join the fun and learn through Rails and later provide the community with a lot of awesome Duplos!</p>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2008/03/21/how-duplo-and-i-offended-people/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails: the Duplo generation</title>
		<link>http://railsontherun.com/2008/03/17/rails-the-duplo-generation/</link>
		<comments>http://railsontherun.com/2008/03/17/rails-the-duplo-generation/#comments</comments>
		<pubDate>Mon, 17 Mar 2008 06:39:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[duplo]]></category>
		<category><![CDATA[lego]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2008/03/17/rails-the-duplo-generation</guid>
		<description><![CDATA[
I&#8217;m sure, at least once in your life you played with Duplos. 
Duplo bricks are eight times the size in volume, twice the length, height and width of traditional Lego bricks, and are easier to handle for younger children. Despite their size, they are still compatible with traditional Lego brick.
Duplos are great to introduce kids [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://cache.lego.com/upload/contentTemplating/LifestyleProductsBags/otherfiles/1033/uploadF2767709-6EFA-4D99-93FA-13F75766309B.jpg" alt="duplo"/><br />
I&#8217;m sure, at least once in your life you played with Duplos. </p>
<p><em>Duplo bricks are eight times the size in volume, twice the length, height and width of traditional Lego bricks, and are <strong>easier to handle for younger children</strong>. Despite their size, they are <strong>still compatible</strong> with traditional Lego brick.</em></p>
<p>Duplos are great to introduce kids to the concept of Lego bricks and to get them to think about building their own creations. However you would freak out if your kid would grow up and not want to start playing with Legos and building more advanced/custom stuff.</p>
<p>Unfortunately, that&#8217;s exactly what&#8217;s going on in the Rails community right now. We created a generation of Duplo developers. </p>
<p><strong>Rick Olson</strong>, AKA <a href="http://techno-weenie.net/">Technoweenie</a> fathered a great majority of this Duplo generation. Rick is a Rails core member and a prolific Rails plugin developer. He has written very popular plugins and Rails apps such as:</p>
<ul>
<li><a href="http://github.com/technoweenie/restful-authentication/tree">restful-authentication</a></li>
<li><a href="http://github.com/technoweenie/attachment_fu/tree">attachment_fu</a></li>
<li><a href="http://github.com/technoweenie/acts_as_versioned/tree">acts_as_versioned</a></li>
<li><a href="http://github.com/technoweenie/permalink_fu/tree">permalink_fu</a></li>
<li><a href="http://mephistoblog.com/">mephisto blog engine</a></li>
<li><a href="http://beast.caboo.se/">Beast forum</a></li>
</ul>
<p>If Rick is the father, the mother of this generation would obviously be <a href="http://www.loudthinking.com/">David Heinemeier Hansson</a>, creator of the Ruby on Rails framework. David has always wanted to make our lives easier, providing us with tools to avoid repeating ourselves and a mass-load of tools to create web apps in no time.</p>
<p>Rick, David and others worked hard to provide the community with tools that cut our development times by 20% to 30% and that&#8217;s just awesome. They basically took their <a href="http://www.meccano.com/">meccano</a> applications and extracted Duplo blocks you can play with.</p>
<p>from <img src="http://upload.wikimedia.org/wikipedia/en/thumb/b/b5/Meccano_model_Steam_shovel_excavator.jpg/250px-Meccano_model_Steam_shovel_excavator.jpg" alt="meccano"/> to <img src="http://upload.wikimedia.org/wikipedia/en/thumb/e/eb/Duplo_bricks.jpg/250px-Duplo_bricks.jpg" alt="Duplo"/></p>
<p><strong>The problem is that a generation of Rubyists has grown up being used to getting everything pre written for them. They haven&#8217;t yet passed the &#8220;Duplo stage&#8221; and basically write applications putting a few blocks together, only writing 10 to 20% and barely understand 5%.</strong></p>
<p>On top of that, what really annoys me is that, these very same developers complain about the existing plugins, always ask for more and don&#8217;t give anything back to the community.</p>
<p>The problem is that it&#8217;s always the same people giving and helping. Relatively quickly, the community grows and people supporting it get tired. I won&#8217;t go as far as <a href="http://www.zedshaw.com/rants/rails_is_a_ghetto.html">Zed and his funny rant</a> but we need to wake up. We need to evolve, learn how Rails magic works, give up the <a href="http://www.therailsway.com/2007/8/1/dangers-of-cargo-culting">cargo culting</a> and start giving back.</p>
<p>The first thing would be to stop complaining about plugins you use on a daily basis and write your own or fork existing ones. <a href="http://github.com">GitHub</a> is a good place to start forking existing projects, if you are a Rails/Ruby beginner, you can help with documentation or submit small patches. <a href="http://hasmanythrough.com">Josh Susser</a> wrote a <a href="http://hasmanythrough.com/layingtracks/LayingTracks.pdf">nice tutorial</a> on how to commit changes (patches/documentation).</p>
<p>Why not blog about issues you have just faced and how you resolved them. Start writing small plugins/gems. Try helping people on the various mailing lists. </p>
<p>And finally, drop the Duplos and start playing with Legos &#8211; don&#8217;t use plugins just because they are available to you, make sure you fully understand what the plugins you use do! Learn more about Rails guts and start using it in a way that makes sense to you.</p>
<p>Why not even switch to meccano and take a look at <a href="http://merbivore.com">Merb</a></p>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2008/03/17/rails-the-duplo-generation/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>GumGum launch, or how to avoid a disastrous launch.</title>
		<link>http://railsontherun.com/2008/02/28/gumgum-launch-or-how-to-avoid-a-disastrous-launch/</link>
		<comments>http://railsontherun.com/2008/02/28/gumgum-launch-or-how-to-avoid-a-disastrous-launch/#comments</comments>
		<pubDate>Thu, 28 Feb 2008 08:42:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[engineyard]]></category>
		<category><![CDATA[gumgum]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[joyent]]></category>
		<category><![CDATA[launch]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[scale]]></category>
		<category><![CDATA[startup]]></category>
		<category><![CDATA[techcrunch]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2008/02/28/gumgum-launch-or-how-to-avoid-a-disastrous-launch</guid>
		<description><![CDATA[For the last few months I worked on a Rails app called GumGum. GumGum is a licensing and distribution platform for online content. GumGum believes paying a flat rate to license content for online use is illogical. Offline, the flat rate model works because distribution is finite. Online, thanks to Google and other search engines, [...]]]></description>
			<content:encoded><![CDATA[<p>For the last few months I worked on a Rails app called <a href="http://gumgum.com">GumGum</a>. <a href="http://gumgum.com">GumGum</a> is a licensing and distribution platform for online content. <a href="http://gumgum.com">GumGum</a> believes paying a flat rate to license content for online use is illogical. Offline, the flat rate model works because distribution is finite. Online, thanks to Google and other search engines, a story lives forever. <a href="http://gumgum.com">GumGum</a> has developed two usage models to fairly monetize a license: pay-per-use and ad supported. Pay-per-use allows publishers to license content on a CPM basis. Ad supported subsidizes the licensing revenue through advertisements, providing the publisher a free license.</p>
<p>Simple concept and great team. When Ari Mir and Ophir Tanz approached me to work on their app I was impressed by their understanding of Web Business. It was not their first start up and as a consultant, you usually prefer to work with some experienced clients. Ari, GumGum&#8217;s CPO was great at defining realistic expectations, and limit the scope of the application which was great since I&#8217;m an Agile/XP fanboy. I believe that really helped us meeting our dead line without feature creeping the app.</p>
<p>We were finally ready to enter a public beta phase, we were running our production server on a godaddy VPS (no comment) and were on the process of migrating to <a href="http://www.slicehost.com/">slicehost</a> where we were running our staging environment. The plan was to go public on Tuesday 12 and have a feel for the load. We also setup an <a href="http://www.amazon.com/gp/browse.html?node=201590011">EC2</a> image to handle some of the background tasks and were thinking of moving to <a href="http://engineyard.com">Engine Yard</a> within few months.</p>
<p>Everything was ready for a launch, when the day before D Day, Ari calls me telling me: &#8220;Good news Matt, <a href="http://www.techcrunch.com/">TechCrunch</a> is going to publish a blog post about us!&#8221;. While he sounded really excited, I couldn&#8217;t believe me ears. </p>
<ol>
<li>The app wasn&#8217;t optimized, darn it all, I hadn&#8217;t even properly indexed the database, no caching, nothing. (it was in the backlog, things I was planning on doing after the public beta launch)</li>
<li>We would never be able to handle the load. Running an app like ours definitely needs more than a 256Mb shared CPU shared host.</li>
<li>Ari asked me if they could embed one of our license object in <a href="http://www.techcrunch.com/">TechCrunch</a> home page.</li>
<li>I had 12 hours to get stuff ready.</li>
</ol>
<h1>Trying to be ready:</h1>
<p><a href="http://www.techcrunch.com/">TechCrunch</a> has 688k <a href="http://feeds.feedburner.com/Techcrunch">RSS subscribers</a>! Even though I asked Ari not to embed one of our protected object inside TC&#8217;s home page, I knew he couldn&#8217;t say no to <a href="http://www.techcrunch.com/about-michael-arrington/">Mike Arrington</a>. (little did I know, they would end up embedding 2 licenses)</p>
<p>I hurried up and started properly indexing the database, ask advice to some of my <a href="http://blog.caboo.se/">cabooser</a> friends, did some quick re-factoring but obviously didn&#8217;t have enough time to rewrite the way we handle tags and tooltips (the overlay popup window that displays when you rollover a picture in our browse page). <a href="http://notch8.com">Rob</a> helped me getting ready and we transformed our staging environment into a secondary production server hoping we would split the load.</p>
<p>Since we didn&#8217;t have a load balancer, we tried to cheat by setting up two A records for gumgum.com. The idea was that browsers would pick an ip randomly and since we were only using 1 database, everything should be fine. That was the theory, during our tests we realized that our Flash object was not using the same IP than the webpage and that was creating random issues with our licensing system.</p>
<p>We were running out of time, I turned on page caching on few actions (home page) so even though my mongrels would die, I knew we would at least be able to display something. Because of our complex authentication system, I couldn&#8217;t cache much and I didn&#8217;t have time to re-factor a lot of my code or to setup <a href="http://www.danga.com/memcached/">memcached</a>. (on top of that I knew the product was stable and I didn&#8217;t want to mess up with it).</p>
<h1>The Storm:</h1>
<p><a href="http://www.techcrunch.com/2008/02/13/gumgum-launches-new-image-licensing-platform/">The article got published</a> and in seconds we saw the load on the main box going from 0.2 to 2.0! We were still dealing with the DNS issues and some pictures were not getting loaded. When Rails got above 60 req/s we started dropping some requests and returning 500s. That was bad, really bad. Our browse page (not optimized) was down and we handled around 80k requests in a matter of few hours. What you don&#8217;t know is that each of our flash object generates a couple of requests, and that <a href="http://techcrunch.com">TechCrunch</a> decided to embed 2 objects on their home page.</p>
<p>Remember, it was our launch, which was not meant to be a big launch, we were not prepared for that!</p>
<h1>Dealing with the load:</h1>
<p>The good thing is that my code didn&#8217;t leak memory, Rails was stable and it was a good sign. We all know that &#8220;Rails CAN scale&#8221;, but we also know that you need to have a proper hosting to do that. Godaddy was not handling the load and it was just the beginning. So what do you do when you have to scale and that your code isn&#8217;t total junk? You call a real hosting company like <a href="http://engineyard.com">EngineYard</a> or <a href="http://joyent.com">Joyent</a>. I was lucky <a href="http://www.workingwithrails.com/person/5421-ezra-zygmuntowicz">Ezra</a> was online. I quickly explained to him the situation, we discussed the reason why our site was not doing so great and defined the bottlenecks. It was simple, we needed more humph. The normal waiting time to get a slice on EY was around 2 weeks back then. Ezra knew that we couldn&#8217;t wait 2 weeks :p He was simply awesome, managed to find us 2 slices, set them up for us and setup our app in less than 2 hours. He even helped us configuring our old server to get NginX to bounce the requests to EY while the DNS was propagating. </p>
<p>As soon as the switch was done, everything loaded perfectly, not a single request dropped, it was simply great.</p>
<p>Since we are talking about scaling, hosting and facing issues, I&#8217;d like to make a simple point: $349.00 a month for a slice is NOT expensive for what you get. First off, EY slices are setup superbly, you get awesome performances out of them, they come ready for your app and you don&#8217;t have to do much. Secondly, I&#8217;m not a sys admin, I really hate dealing with servers, packages, configuration, compiling crap that won&#8217;t compile because I&#8217;m lame&#8230; etc&#8230;<br/><br />
EY has a bunch of experts (both Ruby and Sys admin experts) available 24/7 that always go the extra mile to help you. Last time I checked I couldn&#8217;t hire a good sys admin for, let&#8217;s say the price of 3 or 4 slices. Now, we get a team of guys, available, knowing their stuff and helping me for way cheaper than hiring a sys admin dude. The other thing is, I&#8217;m a consultant, I don&#8217;t want to deal with servers and charge my clients for that. I also want them to be reassured and know that &#8220;yes, we can scale&#8221;. The price of an EY/Joyent slice is the price you pay to be confident you can take the load.</p>
<h1>So what now?</h1>
<p>We have a lot of optimization to do, we are working on moving more of our stuff to EC2 to avoid being charged for bandwidth twice (user => EY => S3), we are setting up a queuing system and we have a lot of nice features to deploy. But one thing for sure, I can focus on my code since I know EY has my back and I don&#8217;t have to worry about our servers.</p>
<p>p.s: <a href="http://gumgum.com">GumGum</a> is doing great, a lot of people are really interested in the product, new features are coming up (we already auto import content from some major Paparazzi agencies) and we are getting a <a href="http://blog.gumgum.com/2008/02/gumgums-press.html">good press coverage</a></p>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2008/02/28/gumgum-launch-or-how-to-avoid-a-disastrous-launch/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Rails 2.0.2 with few changes</title>
		<link>http://railsontherun.com/2007/12/17/rails-2-0-2-with-few-changes/</link>
		<comments>http://railsontherun.com/2007/12/17/rails-2-0-2-with-few-changes/#comments</comments>
		<pubDate>Mon, 17 Dec 2007 09:52:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[contribution]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[tasks]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2007/12/17/rails-2-0-2-with-few-changes</guid>
		<description><![CDATA[What&#8217;s new?


Rails default database is now sqlite3. If you are running Leopard, everything is already setup for you. As DHH mentioned, just &#8220;rails -d mysql yourappname&#8221; if you want to generate a new app preconfigured for MySQL.
Sqlite3 is great and if the only reason why you didn&#8217;t give it a try is because you have [...]]]></description>
			<content:encoded><![CDATA[<h2>What&#8217;s new?</h2>
<ul>
<li>
<p>Rails default database is now sqlite3. If you are running Leopard, everything is already setup for you. As DHH mentioned, just &#8220;rails -d mysql your<em>app</em>name&#8221; if you want to generate a new app preconfigured for MySQL.<br />
Sqlite3 is great and if the only reason why you didn&#8217;t give it a try is because you have to use CocoaMySQL, then check out <a href="http://sqlitebrowser.sourceforge.net/">sqlitebrowser</a></p>
</li>
<li>
<p>Other new feature: rake secret  to generate a key used to encrypt your session. Really useful task when you&#8217;re migrating an app to 2.x</p>
</li>
<li>
<p>To improve performance, some changes were made to the template caching and you have to restart your production server after a template modification.</p>
</li>
<li>
<p>Validates acceptance of still works for non-existent tables . (sorry <a href="http://blog.hasmanythrough.com/">Josh</a>, I won&#8217;t post after 2am, especially when I forget your life changing bug fix <img src='http://railsontherun.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )</p>
</li>
<li>
<p>Added option to pass proc to ActionController::Base.asset_host for maximum configurability. Example:</p>
</li>
</ul>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre>1<tt>
</tt>2<tt>
</tt>3<tt>
</tt>4<tt>
</tt><strong>5</strong><tt>
</tt>6<tt>
</tt>7<tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">    <span class="co">ActionController</span>::<span class="co">Base</span>.asset_host = <span class="co">Proc</span>.new { |source|<tt>
</tt>      <span class="r">if</span> source.starts_with?(<span class="s"><span class="dl">'</span><span class="k">/images</span><span class="dl">'</span></span>)<tt>
</tt>        <span class="s"><span class="dl">&quot;</span><span class="k">http://images.example.com</span><span class="dl">&quot;</span></span><tt>
</tt>      <span class="r">else</span><tt>
</tt>        <span class="s"><span class="dl">&quot;</span><span class="k">http://assets.example.com</span><span class="dl">&quot;</span></span><tt>
</tt>      <span class="r">end</span><tt>
</tt>    }</pre>
</td>
</tr>
</table>
<ul>
<li>Finally, I added 2 new rake tasks: db:migrate:redo and db:migrate:reset<br/><br />
db:migrate:redo rolls back your database and then migrates it up. You can define the STEP constant to specify the amount of steps you want to rollback. This task is very useful in development mode when making a modification to the latest migration(s).<br />
db:migrate:reset will drop your database, re create it and migrate it up. Only use this task if you really have to and only in development/test environment.  Use db:reset in production mode since it uses the schema.rb file and won&#8217;t go through the hundreds of migrations you might have.</li>
</ul>
<h2>Changeset</h2>
<p><em>2.0.2</em> (December 16th, 2007)</p>
<ul>
<li>
<p>Changed the default database from mysql to sqlite3, so now running &#8220;rails myapp&#8221; will have a config/database.yml that&#8217;s setup for SQLite3 (which in OS X Leopard is installed by default, so is the gem, so everything Just Works with no database configuration at all). To get a Rails application preconfigured for MySQL, just run &#8220;rails -d mysql myapp&#8221; [DHH]</p>
</li>
<li>
<p>Turned on ActionView::Base.cache<em>template</em>loading by default in config/environments/production.rb to prevent file system stat calls for every template loading to see if it changed (this means that you have to restart the application to see template changes in production mode) [DHH]</p>
</li>
<li>
<p>Introduce <code>rake secret</code> to output a crytographically secure secret key for use with cookie sessions #10363 [revans]</p>
</li>
<li>
<p>Fixed that local database creation should consider 127.0.0.1 local #9026 [parcelbrat]</p>
</li>
<li>
<p>Fixed that functional tests generated for scaffolds should use fixture calls instead of hard-coded IDs #10435 [boone]</p>
</li>
<li>
<p>Added db:migrate:redo and db:migrate:reset for rerunning existing migrations #10431, #10432  [matt]</p>
</li>
<li>
<p>RAILS<em>GEM</em>VERSION may be double-quoted also.  #10443 [James Cox]</p>
</li>
<li>
<p>Update rails:freeze:gems to work with RubyGems 0.9.5.  [Jeremy Kemper]</p>
</li>
<li>
<p>Added delete<em>via</em>redirect and put<em>via</em>redirect to integration testing #10497 [philodespotos]</p>
</li>
<li>
<p>Allow headers['Accept'] to be set by hand when calling xml<em>http</em>request #10461 [BMorearty]</p>
</li>
<li>
<p>Added OPTIONS to list of default accepted HTTP methods #10449 [holoway]</p>
</li>
<li>
<p>Added option to pass proc to ActionController::Base.asset_host for maximum configurability #10521 [chuyeow]. Example:</p>
<p>ActionController::Base.asset_host = Proc.new { |source|<br />
  if source.starts_with?(&#8216;/images&#8217;)<br />
    &#8220;http://images.example.com&#8221;<br />
  else<br />
    &#8220;http://assets.example.com&#8221;<br />
  end<br />
}</p>
</li>
<li>
<p>Fixed that ActionView#file<em>exists? would be incorrect if @first</em>render is set #10569 [dbussink]</p>
</li>
<li>
<p>Added that Array#to<em>param calls to</em>param on all it&#8217;s elements #10473 [brandon]</p>
</li>
<li>
<p>Ensure asset cache directories are automatically created.  #10337 [Josh Peek, Cheah Chu Yeow]</p>
</li>
<li>
<p>render <img src='http://railsontherun.com/wp-includes/images/smilies/icon_mad.gif' alt=':x' class='wp-smiley' /> ml and :json preserve custom content types.  #10388 [jmettraux, Cheah Chu Yeow]</p>
</li>
<li>
<p>Refactor Action View template handlers.  #10437, #10455 [Josh Peek]</p>
</li>
<li>
<p>Fix DoubleRenderError message and leave out mention of returning false from filters.  Closes #10380 [Frederick Cheung]</p>
</li>
<li>
<p>Clean up some cruft around ActionController::Base#head.  Closes #10417 [ssoroka]</p>
</li>
<li>
<p>Ensure optimistic locking handles nil #lock_version values properly.  Closes #10510 [rick]</p>
</li>
<li>
<p>Make the Fixtures Test::Unit enhancements more supporting for double-loaded test cases.  Closes #10379 [brynary]</p>
</li>
<li>
<p>Fix that validates<em>acceptance</em>of still works for non-existent tables (useful for bootstrapping new databases).  Closes #10474 [hasmanyjosh]</p>
</li>
<li>
<p>Ensure that the :uniq option for has_many :through associations retains the order.  #10463 [remvee]</p>
</li>
<li>
<p>Base.exists? doesn&#8217;t rescue exceptions to avoid hiding SQL errors.  #10458 [Michael Klishin]</p>
</li>
<li>
<p>Documentation: Active Record exceptions, destroy<em>all and delete</em>all.  #10444, #10447 [Michael Klishin]</p>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2007/12/17/rails-2-0-2-with-few-changes/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>keeping my javascript files organized</title>
		<link>http://railsontherun.com/2007/12/05/keeping-my-javascript-files-organized/</link>
		<comments>http://railsontherun.com/2007/12/05/keeping-my-javascript-files-organized/#comments</comments>
		<pubDate>Wed, 05 Dec 2007 04:01:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[content_for]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[low pro]]></category>
		<category><![CDATA[lowpro]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[structure]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2007/12/05/keeping-my-javascript-files-organized</guid>
		<description><![CDATA[I was recently asked by Rubyist friend (Josh Knowles) how I was organizing my Javascript files when using LowPro.
LowPro is the best solution for doing Unobtrusive Javascript using Prototype.
With the help of LowPro, you define behaviors that get triggered by the user. This is great, however, you&#8217;ll notice that some behaviors are used all over [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently asked by Rubyist friend (<a href="http://joshknowles.com/">Josh Knowles</a>) how I was organizing my Javascript files when using <a href="http://lowpro.stikipad.com/home/show/HomePage">LowPro</a>.</p>
<p><a href="http://lowpro.stikipad.com/home/show/HomePage">LowPro</a> is the best solution for doing <a href="http://en.wikipedia.org/wiki/Unobtrusive_JavaScript">Unobtrusive Javascript</a> using <a href="http://www.prototypejs.org/">Prototype</a>.</p>
<p>With the help of <a href="http://lowpro.stikipad.com/home/show/HomePage">LowPro</a>, you define behaviors that get triggered by the user. This is great, however, you&#8217;ll notice that some behaviors are used all over the place (a date chooser for instance) and some complicated behaviors only get used on very specific pages.</p>
<p>First things first, let&#8217;s look at the header in my application.html.erb file (located in app/views/layouts).<br />
This is the default layout used by all my views, I rarely use more than 5 layouts per app and always use a default layout.</p>
<p>Please note that I&#8217;m using Rails 2.0 so some features you&#8217;ll see in my file won&#8217;t work in Rails 1.2.x. (if you want to know about all the new Rails sexiness, check on <a href="http://peepcode.com/products/rails2-pdf">this awesome Peepcode PDF</a>.</p>
<p>Here we go:</p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre>1<tt>
</tt>2<tt>
</tt>3<tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">  &lt;%= javascript_include_tag <span class="s"><span class="dl">'</span><span class="k">prototype</span><span class="dl">'</span></span>, <span class="s"><span class="dl">'</span><span class="k">effects</span><span class="dl">'</span></span>, <span class="sy">:cache</span> =&gt; <span class="pc">true</span> <span class="s"><span class="dl">%&gt;</span><span class="k"><tt>
</tt>  &lt;%= javascript_include_tag 'lowpro', :cache =</span><span class="dl">&gt;</span></span> <span class="pc">true</span> <span class="s"><span class="dl">%&gt;</span><span class="k"><tt>
</tt>  &lt;%= javascript_include_tag  'application', :cache =</span><span class="dl">&gt;</span></span> <span class="pc">true</span> <span class="s"><span class="dl">%&gt;</span></span></pre>
</td>
</tr>
</table>
<p>The first thing you might notice is that I don&#8217;t use</p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre><tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">  &lt;%= javascript_include_tag <span class="sy">:defaults</span> <span class="s"><span class="dl">%&gt;</span></span></pre>
</td>
</tr>
</table>
<p>The reason? I don&#8217;t want to load prototype.js, effects.js, controls.js, dragdrop.js, and application.js all at once. I almost never use drag&#8217;n'drop and seldom use Autocompleter and InPlaceEditor so why loading them in each and every single page of my apps? I&#8217;m not saying they are bad libraries, I&#8217;m just saying that in more than 80% of my page, I don&#8217;t use them, so they should not be in my default page load.</p>
<p>The second thing you might notice, I use :cache => true. Asset caching is a new feature in Rails 2.0 which combines related assets into a single file (works with css and js and only in production mode)<br />
 Note that the above code is untested, but everything should be loaded properly, otherwise, make sure proto gets loaded first, then lowpro, then application. (and you can probably create a one-liner)</p>
<p>All the default behaviors are defined in the application.js file, so they get loaded on all page. However to handle action specific behaviors, I use another Rails trick right in the header:</p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre><tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"> &lt;%= <span class="r">yield</span> <span class="sy">:javascript</span> <span class="s"><span class="dl">%&gt;</span></span></pre>
</td>
</tr>
</table>
<p>Why? Very simple, I want to load some custom JS in the header depending on the action that is used. For instance, when a visitor goes to my fancy ajax photo editor, I want to load the content editor javascript right in the header where it belongs.</p>
<p>For that, I simply need to add the following to my view:</p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre>1<tt>
</tt>2<tt>
</tt>3<tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">  &lt;% content_for <span class="sy">:javascript</span> <span class="r">do</span> <span class="s"><span class="dl">%&gt;</span><span class="k"><tt>
</tt>    &lt;%= javascript_include_tag &quot;photos_show&quot; %</span><span class="dl">&gt;</span></span><tt>
</tt>  &lt;% <span class="r">end</span> <span class="s"><span class="dl">%&gt;</span></span></pre>
</td>
</tr>
</table>
<p>If content_for :javascript isn&#8217;t define, noting is yield in my header and therefore nothing is included but whenever I need, I can access my header directly from the view and insert javascript code in a very clean way.</p>
<p>photos_show.js is the javascript defining all the behaviors related to the photos controller and the show action. I usually only have few actions with a lot of custom behaviors so, these structure works well for me.</p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre>1<tt>
</tt>2<tt>
</tt>3<tt>
</tt>4<tt>
</tt><strong>5</strong><tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">  javascripts<tt>
</tt>    <span class="er">\</span>controller_action.js<tt>
</tt>    <span class="er">\</span>controller_another_action.js<tt>
</tt>    <span class="er">\</span>another_controller_action.js<tt>
</tt>    ...</pre>
</td>
</tr>
</table>
<p>However in the case of an app with a lot of custom behaviors, I recommend using the following structure:</p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre>1<tt>
</tt>2<tt>
</tt>3<tt>
</tt>4<tt>
</tt><strong>5</strong><tt>
</tt>6<tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">  javascripts<tt>
</tt>    <span class="er">\</span> controller_name_<tt>
</tt>            <span class="er">\</span>action_name_.js<tt>
</tt>      <span class="er">\</span>another_controller_name<tt>
</tt>              <span class="er">\</span>action_name_.js<tt>
</tt>  ...</pre>
</td>
</tr>
</table>
<p>That&#8217;s it folks, I&#8217;m not a javascript expert, and if you know better, don&#8217;t hesitate to leave me a comment. What I know for sure, is that since I started using LowPro and behavior driven with Prototype, I have much more fun. Adding a bit of structure is a simple way for me to keep my code clear and help other people who have to work with me. (more on that later)</p>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2007/12/05/keeping-my-javascript-files-organized/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Attachment_fu updated!</title>
		<link>http://railsontherun.com/2007/11/28/attachment_fu-updated/</link>
		<comments>http://railsontherun.com/2007/11/28/attachment_fu-updated/#comments</comments>
		<pubDate>Wed, 28 Nov 2007 08:26:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[attachment_fu]]></category>
		<category><![CDATA[imagescience]]></category>
		<category><![CDATA[minimagick]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rmagick]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2007/11/28/attachment_fu-updated</guid>
		<description><![CDATA[I recently bugged Rick Olson so much about attachment_fu that he gave me SVN access to fix few bugs.
Rick being really busy with ActiveReload he didn&#8217;t spend too much time maintaining attachment_fu.
On my side of things, I&#8217;ve been using attachment_fu on a lot of projects and I&#8217;ve been fixing bugs and adding new features.
My first [...]]]></description>
			<content:encoded><![CDATA[<p>I recently bugged <a href="http://techno-weenie.net/">Rick Olson</a> so much about <a href="http://svn.techno-weenie.net/projects/plugins/attachment_fu/">attachment_fu</a> that he gave me SVN access to fix few bugs.</p>
<p>Rick being really busy with <a href="http://activereload.net/">ActiveReload</a> he didn&#8217;t spend too much time maintaining <a href="http://svn.techno-weenie.net/projects/plugins/attachment_fu/">attachment_fu</a>.</p>
<p>On my side of things, I&#8217;ve been using <a href="http://svn.techno-weenie.net/projects/plugins/attachment_fu/">attachment_fu</a> on a lot of projects and I&#8217;ve been fixing bugs and adding new features.</p>
<p>My first contribution to <a href="http://svn.techno-weenie.net/projects/plugins/attachment_fu/">attachment_fu</a> is a fix for the <a href="http://seattlerb.rubyforge.org/ImageScience.html">ImageScience</a> processor.</p>
<p>Attachment_fu is very flexible and let you use your favorite image processor:</p>
<ul>
<li><a href="http://rmagick.rubyforge.org/">RMagick</a> based on <a href="http://www.imagemagick.org/script/mogrify.php">ImageMagick</a> and <a href="http://www.graphicsmagick.org/">GraphicsMagick</a>(known to leak memory and being a pain to setup)</li>
<li><a href="http://rubyforge.org/projects/mini-magick/">minimagick</a> based on <a href="http://www.imagemagick.org/script/mogrify.php">ImageMagick</a></li>
<li><a href="http://seattlerb.rubyforge.org/ImageScience.html">ImageScience</a> based on <a href="http://sf.net/projects/freeimage">FreeImage</a>. </li>
</ul>
<p>Like many rubyists, I like <a href="http://seattlerb.rubyforge.org/ImageScience.html">ImageScience</a> for its simplicity and efficiency. However, <a href="http://svn.techno-weenie.net/projects/plugins/attachment_fu/">attachment_fu</a> had few problems when being used with <a href="http://seattlerb.rubyforge.org/ImageScience.html">ImageScience</a>.</p>
<ul>
<li>File sizes for thumbnails were not saved correctly in the database. Fixed</li>
<li>Thumbnails based on a gif files were not processed properly. So, this was the big problem. <a href="http://sf.net/projects/freeimage">FreeImage</a> has issues dealing with resizing gif files because of the gif palette limitation (256 colors). to avoid this problem thumbnails of gif files are converted to png. However the thumbnail content type info in the database was not saved properly. That&#8217;s now fixed.</li>
<li>Because of the gif bug reported above, any thumbnail link was broken since it was trying to link to the thumbnail version with a gif extension instead of a png one. Fixed</li>
</ul>
<p>I also fixed a small bug related to <a href="http://www.amazon.com/gp/browse.html?node=16427261">S3 storage</a> and the fact that a_fu had issues loading the config file. (Fixed)</p>
<p>I&#8217;ll also try be able to add some of the S3 features I&#8217;ve been working on. As well as maybe enhancing the validation process. </p>
<p>In the mean time, you might want to read <a href="http://the.railsi.st/2007/11/27/roll-your-own-attachment_fu-validations">this blog post</a> about better validation with attachment_fu.</p>
<p>If you are heavily using attachment_fu or starting using it and think that a google group would be great idea, please let me know in the comment and I&#8217;ll try to convince Technoweenie that we need to set that up <img src='http://railsontherun.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Ooohh I almost forgot, if you fixed some bugs you found while using a<em>fu, please contact me so we can get a</em>fu bug free.</p>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2007/11/28/attachment_fu-updated/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>

