Displaying 2 results from an estimated 2 matches for "nullobject".
Did you mean:
null_object
2006 Jun 21
1
ActiveRecord has_one default value
...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/.
2011 May 04
1
General "nil" reference class object
Dear John and others,
I've been wondering about whether there's any way to indicate a "nil"
reference class object, which will represent "no value", and be tested
for, but not fail the internal type checking. NULL is the obvious
choice (or seems so to me), but can only be used if an explicit class
union is created:
> Foo <- setRefClass("Foo")
> Bar