Set default value in rails model
January 14, 2013I like to set default values in my models. This is the method I like to use.
def after_initialize
if new_record?
self.upper_quantity ||= 0.0
end
end
I like to set default values in my models. This is the method I like to use.
def after_initialize
if new_record?
self.upper_quantity ||= 0.0
end
end