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

Let us know how we can contact you.

Thank you!

We'll respond shortly.

David Stevenson

Posts By

PIVOTAL LABS
03/13/13: [SF] Use postgres!

Helps eager-loading nested polymorphic associations We have a controller action that performs n+1 queries to present associated models as nested hashes. The typical solution is to use :include to eager-load associations. Unfortunately, the models are related polymorphically, and :include can’t eager-load nested polymorphic associations.

Read more »

PIVOTAL LABS
Standup for 2/9/2012: NP in P time? As usual, no.

Ask for Help

"How can I know all the descendants of a class in the superclass at load time in ruby? I want to create a scope for each subclass."

You can't.

"What popovers should I use?"

We've used at least these two before:

"What recurring billing system should I use?"

We've had good luck with BrainTree and Recurly.

Interesting Things

  • backbone-forms is a plugin to backbone that provides model-based form views similar to rails' form_for functionality.
  • EmberJS meetup will be Feb 21, at our new pivotal office!

PIVOTAL LABS
Standup 2/6/2012: Tracker UI updates

Ask for Help

"pg gem version 0.12.2 seems to be leaving connections open sometimes after our application server is dead. This results in transactions that never finish. Anyone know what's up?"

Interesting Things

  • Tracker released major UI updates on Saturday, and we're getting a lot of positive and negative feedback about it. Fear the change!
  • If you change code that's part of the rails asset pipeline, it won't really take effect until you deleted the cached files and allow the asset pipeline to regenerate them. This is because the pipeline watches for changes in the input files, but not in the source code.

PIVOTAL LABS
Standup for 5/13/2011: requiring yaml and psyche, order matters

Interesting Things

  • require "psyche"; require "yaml"? WRONG! We've found you have to do them in opposite order or your parsing is "all screwed up".

PIVOTAL LABS
Standup 5/12/2011: Is it easy to patch a gem's dependencies to upgrade a version?

Ask for Help

"Rubymine is excluding code in our gem's spec/ directory from being indexed, can that be changed?"

We assume this is an optimization, because most people aren't interested in anything from a gem except the lib/ directory. There doesn't appear to be a way to change this behavior.

"How can I override the gem version requirements on annoying gems in my project?"

We're trying to bring in rails 2.3.2 + rack 1.1.x, but rails explicitly requires the old version of the rack gem. Can we do something sneaky to change the requirements without forking and modifying the gem??

"Is there a good set of practices for exposing ActiveRecord models to JavaScript?"

Like using Backbone.js model support? Or maybe just straight #to_json on models and embedding them into HTML templates?

PIVOTAL LABS
Standup 5/10/2011: How safe are you videos over RTMP?

Ask for Help

"Is flash RTMP streaming a secure way to stream video so it can't be downloaded?"

We're using this with CloudFront + S3. But will it protect our content enough?

"RubyMine + rspec 2.6, why won't my focused tests run?"

We hoped this could be easily fixable by detaching the rspec gems and reattching them, but no luck with our usual fixes.

"MixPanel, is it a good tool for analytics and log analysis? "

Compared to normal analyics tools or splunk for log analysis?

"Anyone ever stubbed out 3rd party calls to a Thrift RPC service before?"

Is there a better solution than some sort of standard generic ruby stubbing & expectation tool?

Interesting Things

  • Postgres is giving us some weird behavior on Heroku when we have column names longer than 27 characters. We think the update_attribute calls are not being persisted but no errors are generated.
  • There are finally some viruses/trojans for mac OSX that are gaining traction. Careful what you download!
  • The net-ssh-telnet gem makes running a scripted batch SSH session pretty easy. This might be a good tool for you, if you want something much less complicated than capistrano or chef server for remote automation.

PIVOTAL LABS
Standup 11/22/2010: How can a rails engine provide migrations?

Ask for help

  • We just upgraded one project from Devise 1.1 to Devise 1.2 and reported "many problems which blew up all sorts of stuff". It was bad enough we had to rollback. Are there others with failure or success stories for this upgrade?
  • Can you rate limit EC2 nodes using an Elastic Load Balancer? We'd like to cap the amount of traffic that can be sent to an app instance. I'm thinking advanced use cases like this are probably why you run your own haproxy instead of using ELBs.
  • How are people running database migrations in their engine gems? I know rails 3.1 promises to bring this to the table, but is there a backport gem we can use?

Interesting

  • iOS 4.2 is out! We're looking forward to trying it on the iPad (finally).

LABS
Standup 5/28/2010: rails new :inverse_of association option automatically creates backreferences

Interesting Things

  • has_many and belongs_to associations can now automatically create back references each other, thanks to a Backport of :inverse_of from Rails 3 to rails 2.3.6. This allows us to keep our object graphs more correct and avoid situations where we have 2 copies of the same object because the object graph is walked in reverse. Here's how to use it:
class Parent < ActiveRecord::Base
  has_one :child, :inverse_of => :parent
  accepts_nested_attributes_for :child
end

class Child < ActiveRecord::Base
  belongs_to :parent
  validates_presence_of :parent
end

PIVOTAL LABS
Standup 4/28/2010: Webrat threading errors & new RubyMine version

Ask for Help

"We keep getting webrat thread exceptions running our integration specs with the rails integration runner: Thread tried to join itself. The error message varies with different versions of ruby 1.8.6 vs 1.8.7."

Anyone had this problem or know why?

"How do I skin an iphone mobile site to be the correct width so it's not 980px wide?"

<meta name="viewport" content="width = device width" />

*"We're trying to deploy some nginx configuration changes to EngineYard Cloud, what's the right way to do that?"

We've tried building custom chef recipes to solve this problem, but they run after nginx has already restarted, so are a poor solution to this problem. The better solution might be to check in configuration files into the application and symlink them into the nginx configuration directory using a before_symlink.rb hook in the /deploy directory.

*"We've got a has_many association where some of the child records are originally saved in an invalid state. When we later load the parent and ask it if it's valid, it returns true even with validates_associated. How can we get the desired validation behavior?"

Turns out that unloaded associations are not validated. Solution: load the association before calling .valid? on the parent. In general, you should also not create invalid objects, instead using a state variable to put them into a "draft" or "incomplete" state where they are still valid but not complete. Then remove that state and you'll see the errors required to finish that object.

Interesting Things

  • When RubyMine 2.0.1 won't run your focused specs, try attaching rspec 1.2.9 to it rather than 1.3.x. It fixed this issue for one of our teams.
  • Rubymine 2.0.2 came out today: can finally run focused contexts?! Also including bundler support! What's new
  • We tried our Unicorn on EngineYard cloud: so far so good. It's still "experimental" but seems to work.

LABS
Standup 4/26/2010: Ruby hack night with Sarah Mei

Interesting Things

  • Given a list of IDs, how do you find which ones are not in the database?
ids = [1,2,3,4,5,0]
missing_ids = ids - Model.find_all_by_id(ids).collect(&:id)
  • Sarah Mei is hosting a Ruby Hack Night at pivotal labs tomorrow at 7PM (Tues April 27th. 731 Market St Floor 3, San Francisco).
  • There is an android users group tomorrow. We don't know any more about it than that.