I see your logic.  I’m still mixed on having find_by in all those places.  I think a Deployment.system would be better, DRYer and more flexible over time.

From: Victor Lowther [mailto:notifications@github.com]
Sent: Sunday, March 16, 2014 7:58 AM
To: opencrowbar/core
Cc: Hirschfeld, Rob
Subject: Re: [core] Goodbye, Snapshots. (#79)


In rails/app/models/deployment.rb:

>

> -  scope             :system_root,         -> { where(:system=>true) }   # cannot be named 'system' because of internal method name conflicts

Because there can only ever be one system deployment that must exist, and retrieving a collection, getting the only object in it, and then checking that the object you got was not nil and throwing the exception yourself is more annoying than just using find_by!

—
Reply to this email directly or view it on GitHub<https://github.com/opencrowbar/core/pull/79/files#r10639453>.