Closed kirillsalykin closed 5 years ago
I like this idea, it would be pretty useful. The only issue though is whether to store the default value in the database or just return it if that key hasn't been set. Thoughts?
just return it if that key hasn't been set
i guess this would be perfect
I would like this feature as well
I was just thinking about this :) right now i'm just using a before_create hook on the model to set the default values.
Could you use the default_value_for gem for this functionality?
+1 sitting on 193 keys 95% are strings lol
A default would be great. I could see setting it in the database, especially for boolean values. We have some that default to true
, which means we make column_name != false
comparisons in our code. This also has implications for the query methods:
> Product.is_popular
=> []
> Product.not_popular
=> []
> Product.count
=> 52
it should be possible to add default value, like hstore_accessor :settings, share_via_facebook: :boolean, default: false