Closed rgrinberg closed 11 years ago
There's no public interface for that (yet?) however you can access default attribute value like this:
YourModel.attribute_set[:foo].default.call
In current master I introduced a new method set_defaults
, it's not a public method and it sets defaults on ALL attributes but I could consider making it public and accepting attribute names.
Thanks, that works. +1 for having a clean way to do this in the future.
Say I have an attribute defined like
attribute :foo, Symbol, default: :bar
and I'd like to have a method to reset foo to the default value:bar
in this case. What's the clean way of doing this?Sorry if this isn't the right place to ask..