Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

Standup 9/14/2009: State Machines, comments in ERB, test-unit 2.0.3 breaks RSpec

Nate Clark
Monday, September 14, 2009

Ask For Help

“Anybody use an off-the-shelf State Machine plugin for Rails? Which one?”

Our team recommends using the rubyist-aasm gem from Github. It works well for our current applications, and it appears to be the most actively developed and frequently updated. This gem is the successor to the acts_as_state_machine plugin.

Interesting Things

Don’t use comments in ERB. Writing comments (or any ‘#’ character, for that matter) inside an ERB evaluation block was never right, but some versions of Ruby 1.8.6 allowed it anyway. This is trouble if you upgrade to Ruby 1.8.7 (for example, when upgrading to Snow Leopard) which does not allow comments within ERB.

This is wrong:

<%= link_to "/", home_path #link to the homepage %>

If you really need comments in ERB, do it this way:

<%# link to the homepage %>
<%= link_to "/", home_path %>

test-unit 2.0.3 breaks RSpec. If you upgrade to test-unit 2.0.3, you may notice that your RSpec specs no longer run. Roll back to test-unit < 2.0 (or remove the test-unit gem completely) and you should be back in business.

RubyMine 1.5 early release is available for trying out. Preliminary reports from one Pivot are positive. If you are using Snow Leopard, which ships with Java 1.6, you’ll need to do this hack to get it to run

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

2 Comments

  1. Marko says:

    Exactly, I’ve also noticed that sometimes putting a comment inside a non-outputting ERB tag might result in bad rendering (something missing from the part that follows it).

    September 14, 2009 at 3:37 pm

  2. Daniel Morrison says:

    I’ve been loving pluginaweek’s state_machine on a few projects. Nice and simple, and not tied exclusively to Rails.

    http://github.com/pluginaweek/state_machine

    September 22, 2009 at 8:00 pm

Add New Comment Cancel reply

Your email address will not be published.

Nate Clark

Nate Clark
San Francisco

Recent Posts

  • 09/25/12: It’s about something
  • revealing the ActionController callback filter chain
  • Standup 9/17/2009: silly Ruby tricks, unstub!, iPivotal => PTCruiser
Subscribe to Nate's Feed

Author Topics

agile (6)
rails (1)
rails3 (1)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >