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

Add convenience methods to instantiate model from type #192

Merged

Conversation

bengladwell
Copy link
Contributor

Closes #191

Adds convenience methods StoreModel::Model.from_value and StoreModel::Model.from_values to instantiate StoreModel::Model classes from a type, rather than from the class itself, thus getting type behaviors like unknown attribute handling.

@DmitryTsepelev
Copy link
Owner

Hey @bengladwell! Sounds good, before I merge it in, could you please add some docs on how folks are expected to use it? 🙂

@bengladwell
Copy link
Contributor Author

@DmitryTsepelev - I added docs. Let me know if you would like to see this stuff documented differently. Thanks.

Copy link
Owner

@DmitryTsepelev DmitryTsepelev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs are so awesome that now I wonder why didn't we have it earlier 😅 Thank you so much!

@DmitryTsepelev DmitryTsepelev merged commit 023c181 into DmitryTsepelev:master Nov 7, 2024
20 checks passed
@bengladwell bengladwell mentioned this pull request Nov 14, 2024
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

Successfully merging this pull request may close these issues.

Provide convenience methods for instantiating StoreModel::Models with type behavior
2 participants