Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.


Standup 3/31/2010: Ruby Summer Of Code, Neo4j

Ask for Help

"Our demo site is running on nginx and protected by basic auth. Flash doesn't do basic auth. What do do?"

"Any suggestions for using ActiveResource to access nested resources?" One team was trying to use ActiveResource to access a nested restful web service and found the documentation lacking.

Interesting Things

  • RSOC (Ruby Summer of Code) is looking for mentors. Pivotal is a sponsor and in addition will be providing desk space for some RSOC participants.
  • Neo4j meetup at Twitter HQ tonight! Details on the neo4j blog

Read More

Standup 11/07/2008: Selenium for Flash

Interesting Things

  • Teaser: Selenium for Flash! We've developed a Selenium-like framework for Flash. It's pre-alpha, and needs to be extracted from it's current home inside a project. Are you interested in a Selenium-like framework for Flash, or have you written one yourself? Let us know!
  • STI-weirdness. Rails surprise of the day: given a query of a has_many :photos where Photos has STI subclasses (got that?) Rails will build a SQL query that includes the subclass types of Photo, which you might not want:"Photo")
    # query will have "... WHERE type IN ('Photo', 'OriginalPhoto', 'ThumbnailPhoto')"
  • It appears that the retardase_inhibitor might not work with Rails 2.1.X due to fixes in ActionMailer.

  • JetBrains has been hard at work: they have released both a new Ruby plugin for IntelliJ, and a ruby-specific IDE (based on IntelliJ) named RubyMine.
  • Check out Pivot Jonathan's wife's art exhibit at Artist-Xchange Gallery in San Francisco, Friday 11/7 from 7-10pm:

    Artist-Xchange Gallery
    3169 16th Street
    San Francisco
    CA 94103

Ask for Help

"I want to create a custom launcher for Firefox 2 and Firefox 3 with different profiles. Perhaps the real question is how do we create a custom version of a Mac application launcher, passing in the arguments we need?"

... without having to invoke it on the command line every time.

"We're trying to delete cookies in our Controller, but they keep appearing in the headers anyway."

Suggestion: make sure you are specifying your URL paths and domains correctly.

"Why won't our CSS and other assets load the first time when accessing an SSL-protected domain on Engine Yard?"

It's most likely not Engine Yard or Firefox 3's fault. More research needed.

Read More

Cacheable Flash 0.1.4 — Test Helpers

I just released Cacheable Flash 0.1.4. This version includes test helpers so you can easily test your cache messages. It works by allowing you to make assertions on the flash cookie.

Here is a test/unit example:

  require "cacheable_flash/test_helpers"

  class TestController < ActionController::Base

    def index

      flash["notice"] = "In index"



  class ControllerTest < Test::Unit::TestCase

    include CacheableFlash::TestHelpers

    def setup

      @controller =

      @request =

      @response =


    def test_cacheable_flash_action

      get :index

      asset_equal "In index", flash_cookie["notice"]



Here is a rspec example:

  require "cacheable_flash/test_helpers"

  class TestController < ActionController::Base

    def index

      flash["notice"] = "In index"



  describe TestController, "#index" do

    include CacheableFlash::TestHelpers

    it "writes to the flash cookie" do

      get :index

      flash_cookie["notice"].should == "In index"



You can install Cacheable Flash by running:

ruby script/plugin install svn://

See the Cacheable Flash blog post, Show Flash Messages on Cached Pages, and the README for more information.

Read More

Cacheable Flash

Page caching is an easy way to get massive performance and scalability increases with little up front effort. Of course, when page caching, a number of design changes are necessary. For example, server side session data cannot be used to render data on cached pages.

Rails provides the flash hash to easily render alert messages and errors. In the controller you can write to the flash hash:

flash[:error] = "You cannot go there"

# or

flash[:notice] = "Welcome to eternity"

and render the flash hash in the view. Typically the rendering happens on a layout:

<div id="error_div_id" class="flash flash_error"><%= flash[:error] %></div>

<div id="notice_div_id" class="flash flash_notice"><%= flash[:notice] %></div>

There are some strange quirks with using flash such as needing to use FlashHash#now when rendering the response without redirecting.

Everything works great until you need to page cache the landing page.

For example, lets say you page cache your home page. After logging in, you are redirected to the home page with the flash notice "Logged in successfully". When page caching, this solution does not work because the request is responded to by the Web Server (i.e. Apache) and does not reach the Rails App server (i.e. Mongrel).

This means the view does not get a chance to render the flash error and notice.

There are a couple of solutions to this problem.

  • Do an AJAX request back to the server to render the flash error and notice (i.e. using RJS)
  • Send the flash error and notice from the server with cookies and render it during page load

Introducing Cacheable Flash

To solve the problem using cookies on Peer to Patent, we wrote the Cacheable Flash plugin. The plugin allows you to set the flash hash as normal on the controller. It handles converting the flash hash into cookies. All you need to do is include the CacheableFlash module into your controller.

class ApplicationController < ActionController::Base

  include CacheableFlash

  # ...


On the view side, you will need to add some javascript.

<div id="error_div_id" class="flash flash_error"></div>

<div id="notice_div_id" class="flash flash_notice"></div>

<script type="text/javascript">


  Flash.writeDataTo('error', $('error_div_id'));

  Flash.writeDataTo('notice', $('notice_div_id'));


The Flash.transferFromCookies method:

  • Grabs the flash data from the cookies and saves it to
  • Deserializes the flash hash from JSON to Javascript
  • Erases the flash data from the cookies

The Flash.writeDataTo method:

  • Writes data from the passed in key in to the passed in element or element id

Here is how the life cycle of the login works:

  1. The user enters the correct login information
  2. Rails handles the web request. In the Login controller, flash[:notice] is written to

      if current_user
        flash[:notice] = "Welcome to Eternity"
  3. An after filter serializes contents of the Flash Hash as JSON into cookies

  4. The after filter clears the flash hash
  5. The cached page is rendered
  6. The client side receives and clears the flash cookie data
  7. The client side javascript renders the flash messages

There is also a side benefit -- you don't have to use FlashHash#now because storing the flash in cookies to be rendered and erased by the client makes this unnecessary.

The Cacheable Flash plugin is on the Pivotal RB project page ( You can install it by running:

ruby script/plugin install svn://

It will copy flash.js, cookie.js, and json.js if you do not already have these files.

Happy Page Caching!!

Thanks to Josh Susser for pairing with me on this.

Read More