Recent Posts

Ubiquity meets RubyURL

September 02, 2008

Alex Malinovich decided to take some time this afternoon to write a Ubiquity command for RubyURL using the new RubyURL API. You can take a look at Alex’s Ubiquity code for RubyURL. He’s taking advantage of the JSON support that I added to RubyURL this weekend and JQuery. Be sure to read Alex’s blog post, which includes a screencast! =)

Also! We added this to RubyURL so that if you have Ubiquity installed, you’ll be presented with the following the next time you visit: http://rubyurl.com.

::: thumbnail RubyURL Ā» Keep it short (and
sweet) :::

  • [The new RubyURL
API](http://www.robbyonrails.com/articles/2008/08/31/the-new-rubyurl-api)
```text
-   [RubyURL through
```text
QuickSilver](http://www.robbyonrails.com/articles/2008/01/06/rubyurl-through-quicksilver)
```text
-   [RubyURL bookmarklet
```text
screencast](http://www.robbyonrails.com/articles/2007/08/09/rubyurl-bookmarklet-screencast)

Google Chrome: discuss

September 01, 2008

I’m sure that most of you heard the news that Google is releasing a new web browser named Chrome. Their comic for the announcement was very refreshing and entertaining read. Granted… nobody that I know has seen it (as of today)…

For me, I’m really interested in seeing what they’ve done to hopefully improve some of the short-comings of the user experience through their interaction design process. For example, tabs containing their own url/search fields sounds refreshing (I really dislike the hierarchy currently). Also, I’m really looking forward to their dashboard-like default page.

::: thumbnail Google Chrome - Google Book
Search :::

From a web development standpoint, it definitely raises questions about what we’ll be able to do in the coming year(s).

What are your initial thoughts on this? Discuss…

Update: Gary came across this amusing quote from a response by a representative at Microsoft.

ā€œThe browser landscape is highly competitive, but people will choose Internet Explorer 8 for the way it puts the services they want right at their fingertips … and, more than any other browsing technology, puts them in control of their personal data on-line,ā€ Hachamovitch said. (read article on CNN)

I’m really not sure what that even means. Don’t we already have our online services at our fingertips? I suspect CNN interviewed the wrong person.. because this person said nothing.

Update #2: Only a PC version available… OSX / Linux are in development. Oh well…

The new RubyURL API

August 31, 2008

We’ve just deployed the initial version of an API for RubyURL. It makes it really easy to create RubyURLs and is now open to the public. Should it end up being abused, we’ll consider introducing an API KEY for authenticating and tracking abuse.

In the meantime, you can now start to use the RubyURL API.

For example, the following…

Git: Push it! (real good)

August 29, 2008

After wrestling with some git-remote-branching-merge-problems… I remembered this song…

If you’re using git, you might add this to your [alias] section in .gitconfig.

(notice the up-on-this alias)

Flash Message Conductor

August 29, 2008

Do you find yourself copying and pasting the same code from Rails application-to-application as new projects start? Our team has a handful of projects in development right now and we notice that some of these reusable components tend to get out of sync when we bounce between projects. So, we’re making an effort to spot these and are creating a handful of plugins so that we can keep them updated between projects. (I’m sure that a lot of you do this as well)

In an effort to share some of our patterns, we’ll try to release them into the wild for others to use and perhaps if you have better patterns to offer, we’re always interested in improving our approach.

Introducing Flash Message Conductor

Over the years, our designers and developers have approached the management of flash messages several different ways. In Rails, the default way to add something to a flash message is to do something like this in your controller.


flash[:message] = ā€œYou have successfully signed in to your account.ā€``ruby\

What we began doing a while back is to create a few controller helper methods:


add_message( ā€œYou have successfully signed in to your account.ā€ )ruby\ `add_notice( ā€œYou’ve Got Mail!ā€ )ruby\ add_error( ā€œOops! Something got fucked up!ā€ )```ruby\

Really, nothing too crazy here, just a pattern that our developers have preferred to managing our application’s flash messages.

Okay, so now for the part of the puzzle that we aimed to make consistent across our projects. Rendering flash messages would usually result in several lines of conditionals in our application layout to check if the flash had any values assigned to it. As we worked with our HTML/CSS designers to define a consistent pattern, we moved our code into a helper for rendering flash messages.

With Flash Message Conductor, we just need to pop in the following into our application layout.


<%= render_flash_messages %>``ruby\

If we had called add_message, it’d render the following:

::: {#flash_messages} You have successfully done XYZ… :::

Or, should you have called add_error, it’d render the following:

::: {#flash_messages} Oops! Something went bonkers! :::

What we’ve done here is defined a consistent pattern for our designers and developers to follow. We’ll always have a div container that will use a p tag to display the flash messages with a CSS class value that maps to the type of flash message that we’re displaying. This makes it easier for us to reuse the same flash message styling (and tweak if necessary), but we know that it’ll produce the same HTML across our applications.

Installing Flash Message Conductor

Like most modern Rails applications, you can install with:

RSpec: It Should Behave Like

August 19, 2008

I was going through an older project of ours and cleaning up some specs and noticed how often we were doing the same thing in several places. When we started the project, we didn’t get the benefits of shared groups. Now that we have some time to go through and update some of our older specs, I’ve been trying to take advantage of the features currently available in RSpec. One feature that I haven’t seen a lot of mention of by people is shared groups, so I thought I’d take a few minutes to write up a quick intro to using it.

To pick some low-hanging fruit, let’s take an all-too-familiar method, which you might be familiar with… login_required. Sound familiar? Have you found yourself stubbing login_required over and over throughout your specs?


describe Admin::DohickiesController, ā€˜index’ do

before( :each ) do
controller.stub!( :login_required )
Dohicky.should_receive( :paginate ).and_return( Array.new )
get :index
end

…
end\

If you’re requiring that a user should be logged in when interacting with most of the application (as in the case of an administration section/namespace), you might want to consolidate some of your work into one shared specification group. The basic premise behind this is that you can write a typical describe block and load it into any other spec groups that you need. For example, in our case, we’ll need to stub login_required in several places. We can set this up in one shared group and reference it wherever necessary.

For example, here is what we’ll start off with.


describe ā€œan admin user is signed inā€ do
before( :each ) do
controller.stub!( :login_required )
end
end

describe Admin::DohickiesController, ā€˜index’ do
…\

However, the new describe block isn’t accessible from the block at the bottom of the example… yet. To do this, we just need to pass the option: :shared => true as you’ll see in the following example.


describe ā€œan admin user is signed inā€, :shared => true doruby\ `before( :each ) doruby\ controller.stub!( :login_required )ruby\ `endruby
end``ruby\

Great, now we can reference it by referring to it with: it_should_behave_like SharedGroupName. In our example above, this would look like:


describe ā€œan admin user is signed inā€ do
before( :each ) do
controller.stub!( :login_required )
end
end

describe Admin::DohickiesController, ā€˜index’ do
it_should_behave_like ā€œan admin user is signed inā€

before( :each ) do
Dohicky.should_receive( :paginate ).and_return( Array.new )
get :index
end

…
end

describe Admin::DohickiesController, ā€˜new’ do
it_should_behave_like ā€œan admin user is signed inā€

before( :each ) do
dohicky = mock_model( Dohicky ) Dohicky.should_receive( :new ).and_return( dohicky )
get :new
end

…\

That’s it! Pretty simple, eh? We can now reference this shared group in any describe blocks that we want to. A benefit to this approach is that we can make change the authentication system (say, we decide to switch it entirely and/or even just change method names, set any other prerequisites necessary when an admin is signed in), we’ll have a single place to change in our specs. (tip: you can put these in your spec_helper file)

You can learn more about it_should_behave_like and other helpful features on the RSpec documentation site.

If you have any suggestions on better ways of handling things like this, please follow up and share your solutions. I’m always looking to sharpen my tools. :-)

Update

In response, Bryan Helmkamp suggests that a better solution is to define a method in our specs like, for example: build_mock_user_and_login. then calling it in our before(:each). So, maybe the approach above isn’t the most ideal method but I did wantt o draw some attention to it_should_behave_like. I suppose that I need a better example.. another post, perhaps? :-)

Also, Ed Spencer has posted an article titled, DRYing up your CRUD controller RSpecs, which will introduce you mor to it_should_behave_like.

Thanks for feedback people!

  • [Be Careful that you don’t Stub your Big
Toe](http://www.robbyonrails.com/articles/2007/02/13/be-careful-that-you-dont-stub-your-big-toe)
```text
-   [Spec Your
```text
Views](http://www.robbyonrails.com/articles/2007/08/02/spec-your-views)

Things.app syncs with the iPhone!

August 18, 2008

Awesome. Things 1.1 for the iPhone was just pushed to the Apple iTunes Store, which means… I can finally sync my Things.app with my iPhone!

I’ve been using Things for quite a while to manage my life (work and personal) and bringing this to my phone definitely makes my day.

For more information about Things, visit the following sites:

(iPhone)

I’ll post a review in the coming days as I get a chance to play with it. Just wanted to share the news. :-)

Alan Cooper @ Agile2008 slides

August 12, 2008

Alan Cooper, author of About Face, has slides from his presentation at Agile 2008 online.

If anybody knows if there is video of this talk, please let me know. :-)

Here are a few skitches from the slideshow.

::: thumbnail The Wisdom of
Experience :::

::: thumbnail The Wisdom of
Experience :::

::: thumbnail The Wisdom of
Experience :::

::: thumbnail The Wisdom of
Experience :::

::: thumbnail The Wisdom of
Experience :::

Expanding Rails Boxcar packages

August 04, 2008

If you’re in the market for a new hosting provider for your Ruby on Rails application, you might take a look at the new options for Rails Boxcar. We recently expanded our service offerings into three pricing tiers as well as custom packages for those who need a bit more.

A few things that we’ve recently added support for:

  • Provide us your SSH key during sign up!
-   Allows us to keep your server even more secure by avoiding
    sending passwords over the net
-   Other fun features related to this coming soon
```bash
-   Auto-configured Nginx w/Mongrel cluster
-   Phusion Passenger (**mod_rails**) support! (for those with
```text
mixed-environments)
```text
-   Continued development of [Boxcar
```text
Conductor](http://github.com/planetargon/boxcar-conductor/tree/master))
  • …more in the works!

The best part is that we can get you up and running with a new Boxcar now for as low as $59/month USD.

For more information, visit: http://railsboxcar.com

If you have any questions, don’t hesitate to contact us.

Pair Programming and Micro Projects

July 31, 2008

It’s been quiet because I’ve been busy over the past few months. Projects, vacations, and pair programming with our new developer, Nigel. ;-)

Pair
programming{width=ā€500ā€ height=ā€333ā€}

In other news, Chris and I launched http://ohmyscience.org (on twitter) in an effort to get a small one-night micro-project out the door.

::: thumbnail Oh My Science 2014 replacing god with reason... one tweet at a
time :::

I have a growing list of a few micro-projects that I hope to be helping get developed and launched before the summer is over. Stay tuned!

::: thumbnail Oh My Science 2014 replacing god with reason... one tweet at a
time :::

I hope that you’re all enjoying your summer!

Ruby 1.8.7 on MacPorts causing some problems

June 20, 2008

It appears that MacPorts has upgraded to Ruby 1.8.7, which is good news if you’re running Rails 2.1… but if you have an older Rails application… it’s not going to work too well.

In order to get Ruby 1.8.6 installed with the latest MacPorts, you’ll need to do the following.