Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7993973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:00:46+00:00 2026-06-04T14:00:46+00:00

my query in mongoid model_name = params[:state].classify.constantize @result = model_name.find(:name => params[:name]) the above

  • 0

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 ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:00:48+00:00Added an answer on June 4, 2026 at 2:00 pm

    Are you posting the exact error message? Here’s what I get

    'california'.classify # => "Californium"
    

    I bet you don’t have Californium model 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query written in Mongoid @result = User.find(:name=>xxxxx).limit(5) and I return the
Query : select i.Name,ri.Country,ri.State,ri.City from Information as i join ResidenceInformation as ri order by
I can't seem to find anything to make a date range query using Mongoid/Rails.
I would like to write a query in a Rails model using mongoid, and
Query gives me some error: Msg 156, Level 15, State 1, Line 4 Incorrect
Query 1 works but query 2 doesn't: Query #1: SELECT * FROM `users` WHERE
Query to find All bars that sell three different beers at the same price?
Query Select 9/5 'Showing output as 1 I want to get the exact ouput
I'm trying to write a query for an embedded Mongoid::Document which finds any record
Rails' ActiveRecord has a feature called Query Caching (ActiveRecord::QueryCache) which saves the result of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.