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 307033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:31:17+00:00 2026-05-12T07:31:17+00:00

I have an existing table that I’d like to use for a Rails application.

  • 0

I have an existing table that I’d like to use for a Rails application.
It’s a simple table with only 4 columns. However it does not yet have id column. And also new data will be added periodically.

I am trying to find a way to add the id column and populate it.

I guess I have two options, but being a noob I am sure there are better ways.

Option 1: I can add the id column and populate it when I parse raw data into CSV files, and then import it to the Rails database. In this case, when I parse the data into CSV files, I need to figure out how to find the last used unique id is.

Option 2: Parse raw data into CSV files, then import to the Rails database. Then my rails application will populate the id column for the new data entries.

If Rails has a built in method or GEM that can populate the id fields for the new entries, that would be great. In that case I will go with the Option 2.

If not, I think it’s easier to go with the Option 1.

So I guess the question becomes this: Can Rails automatically populate the id column of entries with blank id field?

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-05-12T07:31:18+00:00Added an answer on May 12, 2026 at 7:31 am

    Either option should work because the underlying database will automatically handle the id column since it’s the primary key. So create the table using a migration, then parse, import, and add the CSV data to your database via which ever method sits best.

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

Sidebar

Related Questions

Lets say I have a simple table that only contains two columns: MailingListUser -
My problem is I have an existing table that I can not modify that
I have an existing table structure that looks something like this: AnimalTable ------------- |Id
I have a table that looks something like this. <table> <thead> <tr> <th>Foo</th> <th>Bar</th>
I have the an existing table that for some reason the designer decided to
I have an already existing table with a field that should be unique but
I have a table that contains partial data that is of no use to
I have an existing table in an Oracle 10gR2 that I added a XMLTYPE
I'm trying to implement EF with an existing table structure that I'm not allowed
I have a migration that adds an index to an existing table using add_index

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.