my query in mongoid
model_name = params[:state].classify.constantize
@result = model_name.find(:name => params[:name])
the above code doesn’t work i get a error wrong constant name California where as the code below works
@result = California.find(:name => params[:name])
My model_name variable consists of the data “California”
which a model in my project. I want to query my db based on the parameters that come in. How to go about this ?
Are you posting the exact error message? Here’s what I get
I bet you don’t have
Californiummodel 🙂