Ruby on Rails Archives

Zed on Mongrel

Posted on February 5th, 2008 by Jeff

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.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

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!

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

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.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

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:



<%= 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!

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

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!!

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

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.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

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.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

J to the double E

Posted on May 24th, 2007 by Chris

RailsConf 2007 We don’t often write about specific technologies here at Bust Out, as we tend to be fairly agnostic and pragmatic about such matters, but we recently sent a contingent off to Portland, OR to attend RailsConf 2007 and we are feeling pretty darn excited about the Rails framework and its future.

What’s the cause of this excitement?

Rails, or Rails adoption rather, is maturing, as was evidenced by the number of talks at RailsConf dealing with what we’ll call “big application” issues, such as server virtualization, scalability “without bounds” and large-scale caching. It was great listening to developers who are pushing the framework into new territory and are devising interesting and creative solutions to resolve whatever performance or scalability issues they run into. It was also interesting to hear how many times Erlang was mentioned during these talks as a very scalable, high performance language that can be leveraged in Rails environments (web servers, messaging etc) to potentially help improve solution scalability.

Now, we’re fans of the Pragmatic Programmers, we follow the trends, read plenty of other blogs and we’ve read (at least half) of The Tipping Point during various bathroom breaks, so we get that Erlang is growing in popularity as well as vaguely how that sort of growth would show itself in a venue like RailsConf.

As such, in anticipation of next years language du jour, we here at Bust Out Solutions feel there’s an intriguing opportunity looming on the horizon. Forget Haskell. And Scala. And Lua. And OCaml. It’s Java.

Got scalability issues with your JRuby on Rails application? You COULD use Erlang-based services, but that’s so last year. Throw it on a cluster of WebSphere App Servers running on some monster AIX boxes, fire up your Tibco ESB for some distributed JMS-ing, WS-ing, JBI-ing or straight up BPEL-ing, get a copy of Oracle Coherence for your distributed caching needs (you can even toss out the database with a big enough grid) and you’ll be all set. There are a lot of choices, which makes the whole experience all sort of infuriatingly fun and lucrative for others if you’re the generous type.

If anyone is interested, we’re open to speaking at next year’s conference. If we get rejected, even better, as I heard RejectConf was more stimulating than the real thing. Or maybe we can write a book….Java for Rails Developers?

As an aside, hats off to the community at RailsConf for donating over $30,000 to charity. It was a great idea and wonderful gesture from the community. Next year, we can surely do even better.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Point Clinic gets Shopified

Posted on May 20th, 2007 by Jeff

Point Clinic Shopify store We recently launched an e-commerce section of the Point Clinic website. Play handled the graphic design and photography, and Bust Out Solutions implemented the e-commerce functionality. We used Shopify, a Ruby on Rails e-commerce engine built by the folks at Jaded Pixel. Shopify allows you to create a full-blown e-commerce store in literally a few minutes if you use one of their pre-built templates. If your company is like Point Clinic and has a specific look and feel to your website, Shopify provides a template engine called Liquid that allows you to create custom designs. The learning curve for Liquid is rather shallow so I was able to run through several design iterations with Play.

Shopify also comes with an impressive admin interface that allows users to maintain items and item attributes, set stock on hand, create collections, set promotions, define shipping and handling rates, manage orders and backorders, track demand, and even create a blog. All basic retail functionality is available via the Shopify admin pages, giving you full power to run your online store.

We’re now offering Shopify design and engineering services to anybody who wants to get a relatively cheap e-commerce site up and running in no time. Contact us if you’re interested in hearing more.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Rails modal windows

Posted on April 28th, 2007 by Jeff

I dug around for a while yesterday looking into how to close prototype modal windows upon a successful ajax post while ensuring proper error handling. I discovered two excellent blog entries on the subject at javathehutt and richtextblog. Unfortunately, neither of them quite fit my case or fully addressed my issue. Of course, I could just avoid the use of modal windows for my forms, but then what else would I do with myself on a Saturday afternoon? As it turns out, with RJS, what I needed is quite easy.


render :update do |page|
   page.call 'top.Windows.close', 'window_id'
end
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]