Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attribute type defaults? #79

Open
blairanderson opened this issue Mar 17, 2017 · 0 comments
Open

attribute type defaults? #79

blairanderson opened this issue Mar 17, 2017 · 0 comments

Comments

@blairanderson
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant