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

Experiment using Ruby's 3.2 Data structures for the DTOs #41

Open
santib opened this issue Oct 10, 2022 · 0 comments
Open

Experiment using Ruby's 3.2 Data structures for the DTOs #41

santib opened this issue Oct 10, 2022 · 0 comments

Comments

@santib
Copy link
Owner

santib commented Oct 10, 2022

These Data objects are similar to Structs but they are immutable. This property sounds interesting for the DTOs that this gem generates. There might be some challenges though, like how to keep these DTOs be ActiveModel compliant, or having methods like ==.

One option could be that if you set active_model_compliace to false then you get a Data object, otherwise you get what you get today. If this feels too strict, Data.define classes can be extended in theory, so they might be able to provide enough ActiveModel stuff to make Rails happy.

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