Ruby on Rails Archives

Top Underreported Tech Stories of 2009

Posted on December 28th, 2009 by Jeff Lin

One of my favorite quotes by Ruby on Rails founder David Heinemeier Hanson was at Minnebar 2007 when somebody asked him if Ruby on Rails was ready for the “Enterprise.” His response was something like, “To me ‘Enterprise’ is just steak dinners, strip clubs, and expense accounts.” (Anybody have the exact quote?)

Whether you hold The Enterprise in high esteem or not, introducing new technologies into large IT departments is a challenge. It’s difficult to teach an old dog new tricks, and that’s especially true for large corporations with a lot of inertia.

That said, we’re honored to be mentioned in the InfoWorld article about the Top Underreported Stories of 2009. Sitting at #7 is the respect for Ruby on Rails in the enterprise, and our work on Best Buy IdeaX is used as one example.

The bundled mysql.rb driver has been removed from Rails 2.2

Posted on January 23rd, 2009 by Jeff Lin

If you’re getting this error, install the mysql gem by executing the following command:

sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

This worked for me, and I’m using Mac OS X 10.5.6, Rails 2.2.2, and MySQL 5.0.67.

Install ImageScience and FreeImage on Mac OS X

Posted on December 17th, 2008 by Jeff Lin

If you plan on allowing users to upload images to your Rails site, you’re probably using Rick Olson’s attachement_fu plugin. You’ve also probably come across Mike Clark’s File Upload Fu tutorial.

Step one of Mike’s tutorial requires you to install an image processing library. ImageScience is simple and does the trick. To save you some time, follow my steps to get things installed and running quickly on Mac OS X.

  1. Install MacPorts. I’d recommend just downloading the “dmg” disk image and running the installer.
  2. Install FreeImage:
    sudo port install freeimage
  3. Install the RubyInline gem:
    sudo gem install RubyInline
  4. Install ImageScience:
    sudo gem install image_science

That should get you through step one of Mike’s tutorial in no time.

Zed on Mongrel

Posted on February 5th, 2008 by Jeff Lin

Hear about Mongrel from the creator himself on this InfoQ online video. Good presentation, even without any insulting, cursing, or self-inflation. Well, not that much, at least.

DataMapper 0.2 and Rails

Posted on November 17th, 2007 by Chris

The DataMapper ORM framework is forging ahead and is now on version 0.2.3. In my previous DataMapper post I wrote about how to get started using the 0.1 release of DataMapper in Rails. Today, let’s look at some of what’s new installation-wise, as well as how well DataMapper is handling relationships between our model objects.

First of all, the DataMapper crew has changed to using DataObjects.rb for its database driver stuff. If you’re running OSX Leopard and MySQL as we are here at Bust Out, then you’ll want to visit this excellent post to help you get up and running.

Two addendums to the above. The first is that I needed to install the json_pure gem as well in order to get DataMapper running correctly:


    sudo gem install json_pure
 

Secondly, if you happen to encounter something like this little gem when firing up your Rails console:


dyld: NSLinkModule() error
dyld: Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.
15.dylib
Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/
mysql.bundle
Reason: image not found
Trace/BPT trap

you can fix it using the following suggestion from the DataMapper mailing list.

Now that we hopefully have our new version of DataMapper correctly installed, lets take a look at it in action. Last time around, I made myself a drink to celebrate the successful install of DataMapper. This time, let’s continue building our restaurant by including a bar and then invite some people over to discuss the relative merits of ORM design patterns (or not):


>> r = Restaurant.new
=> #
>> r.name = "Hawaiian BBQ"
=> "Hawaiian BBQ"
>> r.save
=> true
>> b = Bar.new
=> #
>> b.name = 'Hula Lounge'
=> "Hula Lounge"
>> b.restaurant = r
=> #
>> b.save
=> true
>> b.restaurant
=> #
>> p = Patron.new
=> #
>> p.first_name = "jeff"
=> "jeff"
>> p.last_name = "lin"
=> "lin"
>> p.save
=> true
>> r.patrons << p
=> [#]
>> r.save
=> nil
>> r.patrons
=> [#]
>> p = Patron.find 1
=> #
>> p.restaurant
=> #
>> d = Drink.new
=> #
>> d.name = "Trumer Pils"
=> "Trumer Pils"
>> b.drinks << d
=> [#]
>> b.save

Hopefully at this point you get the idea that associations are working quite nicely in DataMapper (assuming any of the above is remotely helpful…wasn’t the most fun to type). So, rather than show you the model classes and keep typing along in the console, I suggest that DataMapper users read the specs that are bundled with the source. They’re quite informative and a good example of how to write specs as well.
Be sure to check out the DataMapper site as well and look for ways to contribute.
Cheers!

Open Source Abuse

Posted on September 22nd, 2007 by Chris

I was doing some research today on using the acts_as_ferret plugin for an upcoming Bust Out site, when I quite accidentally stumbled upon this interesting post regarding how terrible and misleading the plugin apparently is. The tone certainly seems disproportionate to the offense. And I’m no enterprise search architect, but I understand that distributing an index when running in a cluster is a fairly common architectural approach. I sure wouldn’t want to buy this guy a free meal he didn’t like.

I don’t mean to pick out this post in particular, especially as the blog advertises itself as some sort of open source debunking machine. I also don’t mean to oversimplify the (non)-validity of critical postings, as constructive criticism and community policing are both valid reasons for (negative) open exchanges. However, the frequency with which I see fairly narrow, one-sided rants about freely provided software – free to use, free to make all sorts of modifications to and likewise free to ignore, is disconcerting. It seems few things are free these days.

Radiant CMS for Rails Developers

Posted on September 16th, 2007 by Chris

I recently ported an existing Rails site to the Radiant CMS as our client wanted changes more frequently that initially anticipated. The good news is that the port went well. Radiant is a nice system. But I did struggle just a wee-bit. So, as I typically don’t do front-end stuff at Bust Out, I figured I would take the opportunity to post a few things about what I went through from the perspective of a Rails developer accustomed to controlling my own destiny vis-a-vis MVC/Erb, rather than letting a CMS do it for me.

I’ll start with the layout. Our Erb layout looked like the following:



    <%= render :partial => "/layouts/header" %>    
<%= yield :layout %>
<%= render :partial => "/layouts/footer" %>

We’re setting the body class dynamically to highlight page navigation. The yield and render partial statements should look familiar to anyone with a working knowledge of Rails.

Now lets look at the Radiant version of the above, which uses the Radiant tagging system:



	

Radiant provides a number of different ways to generate content, the predominant methods being creating layouts, snippets and pages. In Radiant, our partials become shared snippets, our yield statement is replaced by a content tag, and our sidebar is replaced by a page content part (created in the pages tab) that is inherited by all child pages and can likewise be overridden by child pages with different sidebar content. Lastly, we’re using a Radiant tag that infers the title of the current page being navigated to in order to drive the “where am I” functionality of our header navigation.

A relatively simplistic example, but hopefully somewhat illuminating. In the next post, I’ll discuss creating pages and some more dynamic content. In the meantime, we encourage anyone looking for a nice clean ruby CMS to give Radiant a try. Cheers!

Capistrano 2.0 and Dreamhost

Posted on August 29th, 2007 by Chris

I recently had the pleasure of deploying a few Rails applications to the FCGI funhouse that is Dreamhost, and just to make matters more interesting, I decided to do the deploys using Capistrano 2.0, rather than its better documented predecessor. After fumbling around a bit trying to translate various Capistrano 1.* recipes, as well as reading a number of postings about some incredibly descriptive FCGI error messages (“FastCGI: incomplete headers (0 bytes) received from server “/home/…./public/dispatch.fcgi”), I finally came upon a couple of postings that, when combined, provided the magic formula:

Getting Started With Capistrano On Dreamhost was an extremely valuable resource. The only deviations I made from this entry were the fact that we already have SVN up, asking Dreamhost whereis ruby, rather than taking the shebang suggestion at face value and running the chmod suggestions contained in the following post: Application Error – Rails application failed to start properly. For whatever reason, FCGi required our tmp and log directories to have 755 permissions.

Thanks very much to those two authors for their helpful posts!!

On Simplicity

Posted on May 29th, 2007 by Chris

Two interesting recent articles on the virtues of keeping things (products, projects, etc) small and simple. Be humble, think about your users, create great projects and better code.

Shopify makes the Webware 100

Posted on May 25th, 2007 by Chris

Congratulations to all the folks over at Shopify for being chosen as a finalist for the Webware 100 Awards. Based on our recent implementation experience, I think the distinction is well-deserved. We’ll be sure to cast our votes.