September 2011
3 posts
1 tag
A pattern for handling validations in an...
Recently I struggled a bit to find an elegant and working solution to validate an associated model when destroying another model’s instance. The two models were Account and User and I needed to validate the Account whenever I delete a User.
The two models look like this - very much simplified:
class Account < ActiveRecord::Base
has_many :users, :dependent => :destroy
end
class...
3 tags
On the benefits of refactoring
You can’t build an office block and then decide you had better put in some concrete foundations afterwards.
You can, however build a large scale app and decide you want a different foundation along the way.
When you start an agile project, you “pitch a tent in dirt”.
E.g. write a simple app that lets users drag a ‘job’ - which only has a name and id - onto a...