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

Incorrect validation message for category_id on Spree::StoreCredit #4468

Closed
johnpitchko opened this issue Jul 25, 2022 · 4 comments
Closed

Comments

@johnpitchko
Copy link
Contributor

johnpitchko commented Jul 25, 2022

When creating a store credit via console, I received a validation error. The message indicated that the error was a missing/invalid store credit type attribute, however the real cause of the issue was a missing store credit category attribute.

Solidus Version:

To Reproduce

  1. Sign into Rails console.
  2. Execute the following command (after assuring referential tables are populated):
Spree::StoreCredit.create!(user_id: Spree::User.first.id, amount: 500.00, currency: 'USD', type_id: 1, created_by_id: Spree::User.first.id)
  1. Observe the error message:
ActiveRecord::RecordInvalid: Validation failed: Credit Type can't be blank
  1. Execute the adjusted command, which includes the category_id:
Spree::StoreCredit.create!(user_id: Spree::User.first.id, amount: 500.00, currency: 'USD', type_id: 1, created_by_id: Spree::User.first.id, category_id: Spree::StoreCreditCategory.first.id)
  1. Observe the record created successfully.

Current behavior

Expected behavior

The error message should state that the missing attribute is the category_id, or that Category can't be blank

Screenshots

Desktop (please complete the following information):

  • OS: [e.g. iOS] macOS 12.4
  • Browser [e.g. chrome, safari] Safari
  • Version [e.g. 22] 15.5

Additional context

@gsmendoza
Copy link
Contributor

Thanks @johnpitchko ! I was able to confirm the issue on a fresh Solidus 3.1 app. WIll add this to our list of tickets 👍

@johnpitchko
Copy link
Contributor Author

Thank you @gsmendoza I opened this PR to resolve but note its branched off another PR to fix a Docker issue.

@gsmendoza
Copy link
Contributor

@waiting-for-dev Since #4481 has been merged, I think we can close this issue now.

@waiting-for-dev
Copy link
Contributor

Yeah, thanks @gsmendoza

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

3 participants