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
  • Tools
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

[Standup][NY] STI Rake Gotcha

Matthew Parker
Thursday, June 28, 2012

Interestings

http://avatars.io/

Interested hosted avatar service for getting user avatars from Twitter, Facebook, Intragram, Gravator or Custom.

STI rake gotcha

StiBaseModel.some_scope

  • works as expected in rails console (dev)
  • works as expected in tests
  • exhibits unexpected behavior in a rake task (in development mode)

It’s caused by an autoloading gotcha in dev mode with STI models, which oddly isn’t reproducible in rails console in dev mode (on Rails 3.2.5). The children of the STI model aren’t autoloaded in the rake task in dev mode, so the “type = ?” clause in the queries don’t include the subclasses of the STI base.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Add New Comment Cancel reply

Your email address will not be published.

Matthew Parker

Matthew Parker
San Francisco

Recent Posts

  • A 1 minute test suite, 6 months in
  • Dumb Controllers, Layered Models
  • Building Crash-Proof Applications the YAGNI Way
Subscribe to Matthew's Feed

Author Topics

bloggerdome (5)
open source (1)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Tools
  • 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 >