Open kraken-ua opened 6 years ago
I am able to replicate this issue.
I think the error is the result of validates :price, numericality: true
in line_item.rb on line 35. For some reason when I change the currency, restart the server, and create a new product, the new line_item has a price of nil
which fails validation.
Looking into this, but I don't really understand it. Has anyone seen this before?
👍 It does the same thing if you set the currency to ZAR
.
I have also set the default currency in the system settings on the admin page while the app was running with no change.
This bug seems to occur with most currencies actually.
I managed to get around the issue, I did some byebug's and found that the line_item
on the order was not valid, just as you mentioned @jacobherrington. I also noticed the currency in the line_item
was set to the previous currency. I deleted all the orders
/line_items
in the DB, and now I can add things to my cart just fine.
I'm unable to reproduce this issue with the latest master revision (7a33685), but I did come across this:
On the Admin panel, products are listed but their master price is set to zero, and the input for it (when editing) is empty.
The problem is caused by the sample data we use for the sandbox because we're only creating Price
instances for USD and EUR; any other currency we configure for the sandbox will fail to show the products on the storefront unless the database records are updated accordingly.
@aitbw this is not ideal. What would we need to update in order to use other currencies?
Steps to reproduce
How can you make this happen:
config.currency = "UAH"
.Expected behavior
Redirect to cart with chosen product in it.
Actual behavior
Redirect to home page with flash message - "Price is not valid" 56 string from Orders controller raise it:
System configuration
Gemfile: