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

Thoughts on adding a value transform option or a 'type' option to Attribute? #457

Open
weilandia opened this issue Mar 24, 2020 · 0 comments

Comments

@weilandia
Copy link

weilandia commented Mar 24, 2020

Specifically, I'd like to easily be able to send all id values to the client as strings without having to call to_s on every id attribute and without changing the Rails default of making ids integers.

So, instead of

attribute :contract_id do |obj|
  obj.contract_id.to_s
end

Something like

attribute :contract_id, type: :string

or

attribute :contract_id, coerce: :string
@weilandia weilandia changed the title Thoughts on add a value transform option or a 'type' option to Attribute? Thoughts on adding a value transform option or a 'type' option to Attribute? Mar 24, 2020
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