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

Let us know how we can contact you.

Thank you!

We'll respond shortly.

Standup 08/19/2008

Interesting Things

  • If your wanting better out-of-the-box error messaging you can use one or both of the following plugins:
    • active_record_full_messages_should_be_nicer
    • validates_associated_displaying_associated_errors

If you choose to use both however ORDER DOES MATTER (use the order specified above) otherwise the validates_associated one just doesn’t seem to work.

  • Hash Iterations is very expensive (this includes my_hash.keys and my_hash.to_a etc…). We think this is related to the way hashes are stored in large, sparsely populated hashtables. If you can, avoid iterating over a hash, and if you must, try using a SequencedHash (which is provided by the collections gem) which solves this by storing hashes as both traditional hashtables and arrays, allowing for fast random access (the hashtable) as well as fast iteration (the array).

Ask for Help

“We want to load a different set of libraries for our selenium test than our regular tests. We tried to create a ‘selenium’ environment and pass that to the rake:test task but that didn’t work, anyone know why?”

You cannot run in non ‘test’ environment with the rake tasks as the ‘test’ environment is hard coded into the test task, and passing a different RAILS_ENV seems to only have the effect of telling the ‘test’ environment what database to base it’s schema off of.

Proposed work around – pass a second environment variable e.g. selenium=true and switch on that. (it’s not ideal so we are still open to better solutions)

  1. joshua says:

    Are those error messaging plugins internal pivitol projects?
    I cant find either in the wild.

  2. Chris Bailey says:

    I can’t find them either, and the validates associated one in particular has appeal to me.

  3. Jonathan Barnes says:

    Update: the error message helper plug-ins mentioned in this post are both currently pivotal internal plug-ins. They are both on the long list of pivotal source code that we plan to open source. You can keep an eye on the [Pivotal.rb]( Rubyforge project, for when these particular plug-ins get released

  4. David Stevenson says:

    I ran your benchmarks and a few of my own. Sequenced hash (which keeps an Array and a Hash) takes longer than both iterating over a hash or an array. Array is faster than fast. Hypothetically, sequenced hash should be as fast as Array iteration, but I guess it’s not optimized as well (being written in ruby vs C).

    Good catch!

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *