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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:05:10+00:00 2026-05-23T02:05:10+00:00

I was searching google and stackoverflow for long time, but I can’t find the

  • 0

I was searching google and stackoverflow for long time, but I can’t find the solution of my problem.

Lately, I was using set_primary_key for a table called “employee”, because I need to use ther personnel number as my primary key. If I set the code

`set_primary_key :personel_number`

(Personel_number is already a collumn which I want to use as primary key) into my model before I do rake db:migrate and do migrating at last, I come into troubles when I try to fill my database via browser:

`Couldn't find employee with ID=1`

`app/controllers/mitarbeiters_controller.rb:16:in `show'`

Rails searches for employee with ID=1 but it can’t find, because I set primary key from personel_number with 601 (e.g.).

Can I do something against it or shall I let Rails create it’s own :id first?

  • 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-23T02:05:11+00:00Added an answer on May 23, 2026 at 2:05 am

    It sounds like when the page goes to the controller to create the employee you have a redirect to show the new employee and it is using the default id.

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

Sidebar

Related Questions

I have been searching around using Google but I can't find an answer to
I have a very tricky problem and after long searching (google, stackoverflow, ...) i
I've done a lot of searching on SO and google around this problem, but
I tried google and stackoverflow but I cant seem to find the oficial documentation
I'm struggling to find a solution for this anywhere on Google, maybe i'm searching
I've been searching for the last couple days but can't seem to find a
I've searching for this for a while now online (Google, and StackOverflow), but haven't
I thought this was asked before, but 15 minutes of searching on Google and
I was searching this from long time as I wanted to do some crazy
I've been having this problem for a long time now and I cannot solve

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.