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

Address is not updated after service calls #3

Open
tayeke opened this issue Jan 31, 2022 · 0 comments
Open

Address is not updated after service calls #3

tayeke opened this issue Jan 31, 2022 · 0 comments

Comments

@tayeke
Copy link

tayeke commented Jan 31, 2022

I've had an issue creating some custom validation on my checkout process, because the update service does not update the instance of the class it is acting on. Near this line of code, can see that the flash notice is updated with errors, but the instance @address is still the instance of the address before the service is called.
https://github.com/spree/spree_legacy_frontend/blob/bf44b73278e0efe18806fd3d8d4b343b6efadcd4/app/controllers/spree/addresses_controller.rb#L26

I admit this could be intentional to support a clean state for the @address, but in my case I want the @address with errors, so I've had to make the call and update the reference manually for some reason.

call = update_service.call(address: @address, address_params: address_params)
@address = call.value
if call.success?
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