Reputation: 493
I'm trying to call find with the :params key, using a method call that looks like this:
Product.find(:all, :params => { :name => "Test" })
Error:
ArgumentError: Unknown key(s): params
Calling Product.find(:all)
works just fine, but when I try to pass anything in with the :params
key it throws an error.
Upvotes: 0
Views: 1729
Reputation: 9748
If you are using Rails 3.x try:
Product.where(:name => "Test")
If Rails 2.x try:
Product.find(:all, :conditions => { :name => "Test" })
Upvotes: 6
Reputation: 84190
Product.where(:name => "Test" )
I have never seen a find with a nested hash of parameters. The key should map to your field in the database.
Upvotes: 0