We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Product
validates_uniqueness_of :code, :scope => [:archived => false]
An error that points to the bad syntax in the model validation for Product.
Throws the following error undefined method 'to_sym' for {:archived=>false}:Hash Did you mean? to_s to_yaml to_set.
undefined method 'to_sym' for {:archived=>false}:Hash Did you mean? to_s to_yaml to_set
The error points to the if @product.update(product_params) line in the ProductsController. Full update method is:
if @product.update(product_params)
ProductsController
def update @product = Product.find(params[:id]) if @product.update(product_params) redirect_to @product else render 'edit' end end
Rails version: rails (5.0.0.1)
Ruby version: ruby 2.3.0p0
Has been discussed in this Stack Overflow question.
The text was updated successfully, but these errors were encountered:
I think we should check if scope is a symbol when calling validates_uniqueness_of . Could you open a PR?
scope
validates_uniqueness_of
Sorry, something went wrong.
No branches or pull requests
Steps to reproduce
Product
model with this validation which has bad syntax:validates_uniqueness_of :code, :scope => [:archived => false]
Product
.Expected behavior
An error that points to the bad syntax in the model validation for
Product
.Actual behavior
Throws the following error
undefined method 'to_sym' for {:archived=>false}:Hash Did you mean? to_s to_yaml to_set
.The error points to the
if @product.update(product_params)
line in theProductsController
. Full update method is:System configuration
Rails version:
rails (5.0.0.1)
Ruby version:
ruby 2.3.0p0
Has been discussed in this Stack Overflow question.
The text was updated successfully, but these errors were encountered: