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

minimal database seed silently fails #774

Closed
JuliusR opened this issue Oct 10, 2020 · 1 comment · Fixed by #775
Closed

minimal database seed silently fails #774

JuliusR opened this issue Oct 10, 2020 · 1 comment · Fixed by #775
Labels

Comments

@JuliusR
Copy link
Contributor

JuliusR commented Oct 10, 2020

affected versions

  • master (4.7.99)

steps to reproduce

  1. setup fresh development environment (clone sources and follow SETUP_DEVELOPMENT.md)
  2. make sure that no errors have been printed to the console
  3. login to the foodsoft and fill the new-supplier form
  4. submit the new-supplier form

expected behavior

The form data are posted, and the supplier is created.

actual behavior

The form data are posted, but the supplier is not created. Instead, the new-supplier form is rendered again. It does not show any validation errors.

@JuliusR JuliusR added the bug label Oct 10, 2020
@JuliusR
Copy link
Contributor Author

JuliusR commented Oct 10, 2020

The problem is caused by a chain of silent failures.

The following seed fails because of a missing financial_transaction_class.

SupplierCategory.create(:name => "Other")

As a result, SupplierCategory.first is nil such that the following line does not work properly:

@supplier.supplier_category ||= SupplierCategory.first

Finally, the validation fails. The form is re-rendered in order to show validation errors. However, no validation error is shown in this case (probably because the form does not have an input for the supplier category).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant