I'm looking for a callback that I think is something like
after_initialize and before_create. I'd like it to take
effect whenever a new object is created (unlike before_create which
I believe only happens before saving to a database),
but I do *not* want it affecting the results of, say MyClass.find.
For instance, if in my_class.rb I define:
def after_initialize
self.some_field = "initial value"
end
then MyClass.find(<conditions>).some_field *always* equals
"initial value", which is definitely not what I want.
I'd like null values to remain null as well in finds, so putting
in an "unless self.some_field" wouldn't help me.
Thanks...
-glenn
--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---