rails-settings icon indicating copy to clipboard operation
rails-settings copied to clipboard

attribute type defaults?

Open blairanderson opened this issue 9 years ago • 0 comments

After digging around the code it seems not easily patchable for adding attribute types.

For example, would love to write:

  has_settings do |s|
    s.key :admin, defaults: {admin: false}, types: {admin: :boolean}
  end

it would be a great API to set attribute types and not have to do it for each update.

my current problem:

pry(#<SettingsController>)> person.settings(:info).something
=> false
[24] pry(#<SettingsController>)> person.settings(:info).something = "true"
=> "true"
[26] pry(#<SettingsController>)> p.save!
=> true
[27] pry(#<SettingsController>)> person.settings(:info).something
=> "true" # 

would like for that last value to be true

Would you accept a PR with this change? using versioned rails type casting

blairanderson avatar Mar 17 '17 01:03 blairanderson