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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:13:26+00:00 2026-06-12T15:13:26+00:00

I had a model called Person after following a tutorial online. After a while

  • 0

I had a model called Person after following a tutorial online. After a while we decided that it was more sensible to rename it to User. I went through the code base and did the following:

  1. Renamed all instances of Person to User, person to user, People to Users and people to users, taking care not to clobber anything unrelated.
  2. Renamed all model files appropriately.

I have another model called session:

session belongs_to user

and

user has_many sessions

Prior to running migrations git grep -i person / people and find | grep person / people just return migrations so I’m sure that I have renamed everything properly.

When I go to create a new user which subsequently creates a session I get the following error:

unknown attribute: user_id

Running git grep again I find that the foreign key in sessions is still person_id

create_table "sessions", :force => true do |t|                                                                                                                             
    t.integer  "person_id
    t.string   "ip_address"                                                                                
    t.string   "path"
    t.datetime "created_at", :null => false
    t.datetime "updated_at", :null => false
end    

How can I fix 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-12T15:13:28+00:00Added an answer on June 12, 2026 at 3:13 pm

    just do in a migration

    def change
       rename_column :sessions, :person_id, :user_id
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets assume I had the following Model class A(Models.model): def __init__(self,data): B(a=self,data=data).save() class B(Models.model):
Update following initial comments The model has an object in it called 'Account', of
I have a very simple user model. When I first created it, it had
I had a model that had an unrelated class defined inside of it. I
I have a model called Day that represents a day in a timesheet. I've
I have a model that will be called about 50 times to create 50
I had generated json with my model objects and sended responce to the template.
I had some questions regarding the structure and behavior of a model, using UML,
Had a page that was working fine. Only change I made was to add
Had a good search here but can't see anything that gets my mind 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.