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

  • Home
  • SEARCH
  • 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 7978667
In Process

The Archive Base Latest Questions

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

i was wondering what was the best way to uniquely identify rails objects. im

  • 0

i was wondering what was the best way to uniquely identify rails objects. im storing them in an index, and currently i have been doing so like

$index.document(@paper.id).add(fields, :variable => variables)

where the @paper.id uniquely identifies it. however when i store other objects, ie @card

$index.document(@card.id).add(fields, :variable => variables)

it’s going to overwrite my index because im using the databases autoincrement (which is not unique because they all start and increment by 1). what would be the best solution to having unique identifiers across all my rails objects?

i looked at UUID’s and had some reservations about making them my primary key like in…

http://ariejan.net/2008/08/12/ruby-on-rails-uuid-as-your-activerecord-primary-key/

i could always make a separate column i guess. or i could do something like get the object’s id and then append it to creation_time. are these good ideas? if not, what would be a good solution for this?

thanks!

  • 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-04T09:33:05+00:00Added an answer on June 4, 2026 at 9:33 am

    I would go with a composite of the object id and the name of the objects table.

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

Sidebar

Related Questions

I'm wondering the best way to approach this. I have a JavaScript file in
I have a Spring app and I'm wondering the best way to serve static
I am wondering the best way to solve this problem. I have a datatable
I was wondering what the best way of storing friend relationship data using MongoDB
I'm wondering the best way to query mongo db for many objects, where each
I have to rewrite some old code and I'm wondering the best way to
Wondering the best way to populate a GridView with my object data. I have
I'm using the Page Objects approach with Selenium2 and wondering the best way to
Just wondering the best way to replace in place matches on a string. value.replace(bob,
I was wondering the best way to upload file to a web server in

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.