-
Rails - Delegate Attributes with Override Ability
Ever find yourself in a situation where you wanted to delegate attributes from one model to an associated model unless they were specified in the original model?
I did, and I came up with a revamped version of Rails’ delegate method that not only checks if the original model has a value specified before delegating it to the associated model, but also checks that the associated model exists.
Grab the gist here: http://gist.github.com/70186
Example usage is included in it.
(originally posted on brighter.net)
Posted on October 12, 2009