Aaron Blohowiak on 12 Jun 2007 13:59:56 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PhillyOnRails] Context-Driven Validations


A few times at PubNite, we have talked about validations that change based on context.. i recently ran accross this cool solution:

http://www.lukeredpath.co.uk/2006/9/28/introduction-to-activespec

A few of us have run in to this: "On a recent project, with a particularly complex domain model, there was the need to validate objects in different ways, depending on its state and relationship with other objects. We found there was a lot of pushback as we tried to bend ActiveRecord validations to apply the complex business rules needed. We managed it, but the resulting code wasn’t pretty and certainly not the elegant, clear code you would come to expect from a Ruby or Rails application. In retrospect, the Specification pattern would have been an ideal solution."

Aaron Blohowiak


_______________________________________________ To unsubscribe or change your settings, visit: http://lists.phillyonrails.org/mailman/listinfo/talk