search for: nouniverisity

Displaying 1 result from an estimated 1 matches for "nouniverisity".

2006 Jun 21
1
ActiveRecord has_one default value
...e a way when specifying a has_one association to specify a default value for an object if data is missing in the child table. For instance: class Student has_one :university end if no university is associated to the student in the database, I would like to automatically return an instance of NoUniverisity class instead of it being set to nil. Similar to the NullObject refactoring described in Fowler''s book. Any ideas? Thanks! Jay -- Posted via http://www.ruby-forum.com/.