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

Provide access to underlying model during build/update/save process closer mirroring rails patterns #465

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jkeen
Copy link
Collaborator

@jkeen jkeen commented Feb 27, 2024

I made these updates long ago and have been using them on a private branch. There might still be edge cases I'm not considering, so I'm starting this PR as a place to consider it.

Changes:

# (for creates):
  @resource = MyResource.build(params);
  @resource.data #=> unsaved model with attributes applied


# (for updates):
  @resource = MyResource.find(params);
  @resource.assign_attributes
  @resource.data #=> unsaved model with attributes applied

…closer mirroring rails controller patterns.

Changes:
 - (for creates):
	@resource = MyResource.build(params);
	@resource.data #=> unsaved model with attributes applied
 - (for updates):
	@resource = MyResource.find(params);
	@resource.assign_attributes
	@resource.data #=> unsaved model with attributes applied
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.

None yet

1 participant