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

Let us know how we can contact you.

Thank you!

We'll respond shortly.

Standup 12/03/2009


  • Git branch best practices – we have a customer who doesn’t do acceptance often enough so we’d like to keep production code in a different branch from demo code. Any suggestions?

    Our friend Josh Susser has a good blog post on git branching workflow. Some other suggestions are to have a separate ‘deploy’ branch which you cherrypick changes from your ‘development’ branch with and deploy to production with (this would, however, require a separate integration test process to integrate the cherrypicked changes). Or, of course, round up your customer and have them do acceptance more regularly.

  • RubyMine – some Pivots are having issues running RSpec in their Rails projects.

    The usual steps we take are to make sure you can Command-click the rspec and spec/rails references in your spec_helper.rb and get to the gems they correspond to and to make sure your spec directory is flagged as a test directory in Settings => Project Structure in RubyMine. That didn’t seem to solve this particular issue, though. There was some talk about commenting out arbitrary ‘require’ statements in your files and that change somehow making RSpec run correctly. Strange.

  • Testing paperclip – tests don’t behave correctly when running them in RubyMine. There are issues with the ‘identify’ command.

    A possible issue is that ghostscript is not installed. Paperclip uses ImageMagick which uses ghostscript to identify attachment file types. You can install ghostscript using MacPorts. This can be tough to track down because paperclip appears to just swallow the exception that occurs when using ghostscript. Some other projects are mocking out paperclip in their tests to avoid the issue completely.

  • validates_associated fun in 2.3.5 – it’s changed from 2.3.4. Another change is depending on rack 1.0.1

  • You can now boot from ebs on Amazon

  • It appears that ActiveRecord now validates all associated objects by default, for any type of validation. Given this example:

    class User < AR::Base
      has_many :wibbles
    class Wibble < AR::Base
      validates_presence_of :name

    when you save a User, it will validate all associated wibbles and fail validation if any wibble fails validation. This always happens on create, and it appears happens on update if the association is an auto-save association, which it implicitly becomes if you allow nested attribute create/update for the association.

    Before Rails 2.3.4 a failed validation on an association would give you a moderately nonsensical validation error. In the case of the above example, if the name validation failed on an associated wibble then the user would have the error “Name can’t be blank,” which is, of course, misleading. The attribute name for the error would just be “name”, so tests for the validation would be something like @user.should have(1).error_on(:name)

    As of Rails 2.3.4 (possibly 2.3.3) the error message for a validation failure on an associated object changed to include the object type, so if the name validation failed on an associated wibble then the user would have the error “Wibbles name can’t be blank.” They accomplished this by changing the attribute name for the error to “#{association_name}_#{attribute_name}”, thus “wibbles_name”. Tests for the validation would have to change to @user.should have(1).error_on(:wibbles_name)

    As of Rails 2.3.5, the error message for a validation failure on an associated object is back to what it was pre-2.3.4 (”Name can’t be blank”). However, this is because the attribute name for the error is now “#{association_name}.#{attribute_name}. So, tests have to change again to @user.should have(1).error_on(’’)

    Not really a huge difference, just an annoyance that it keeps changing.

Interesting Things

  • SMSW – this is an annual supermarket street sweep that benefits the San Francisco Food Bank. Ride on bikes, pick up foodstuffs from supermarkets and win prizes while helping the Food Bank! This Saturday 12/5 at noon.

  • Check out the AAU Future Tense exhibit at 688 Sutter Street Gallery – a showing of art that you can actually pick up with your hands! Exhibit is open thru January.

  1. Brian Jenkins says:

    I’ve run into the specs run from RubyMine complain identify problem.

    identify is an ImageMagick command. Paperclip runs ImageMagick commands in child processes instead of using RMagick (to avoid memory leakage?)

    When you run ruby from RubyMine, it doesn’t inherit the PATH environment variable you set in .bashrc, because RubyMine is generally started from finder or quicksilver or the dock or whatever, not from bash.

    You probably have ImageMagick installed through macports at /opt/local/bin.

    There are a number of ways to set the PATH for RubyMine, but the best is to set the PATH properly for the whole machine with /etc/paths.

    Add /opt/local/bin, /opt/local/sbin, and /opt/local/X11/bin to the top of your /etc/paths and reboot the machine.

    Then try your paperclip test from RubyMine again.

  2. Brian Jenkins says:

    Hmm, seems as if you actually need to set the path in /etc/launchd.conf .
    It seemed like this changed with Snow Leopard, but maybe I was just confused. :-/

    bjenkins@gsv:~ 501 $ cat /etc/launchd.conf

    setenv COMMAND_MODE unix2003

    setenv PATH /opt/local/bin:/opt/local/sbin:/opt/local/X11/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin::/usr/X11/bin:/opt/PalmSDK/0.1/bin

    BTW, “setenv COMMAND_MODE unix2003″ makes OSX act more like Unix and less like OS 10.3.

    This lets unix nerds type “ps -ef” and not be frustrated by OSX pretending not to know what they mean.

    (Note that there is no “=” in a setenv command line. This often trips me up.)

Post a Comment

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

* Copy This Password *

* Type Or Paste Password Here *