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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:06:36+00:00 2026-05-20T20:06:36+00:00

Im tryign to update a model of mine so that it will have a

  • 0

Im tryign to update a model of mine so that it will have a created_by and updated_by field. Looking into some questions and answers here, it seems I don’t have the same problem as them.

My TestCase model should have a created_by and updated_by foreign key, but it should both be a User class. Is that possible?

something like:

belongs_to :user, :foreign_key => 'created_by'
belongs_to :user, :foreign_key => 'updated_by'

Keep in mind that created by and updated_by can be different(meaning another user can edit the testcase)

  • 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-20T20:06:37+00:00Added an answer on May 20, 2026 at 8:06 pm

    Try to use:

    belongs_to :creator, :class_name => "User", :foreign_key => 'created_by'
    belongs_to :updater, :class_name => "User", :foreign_key => 'updated_by'
    

    You should refer to that objects through:

    item.creator
    item.updater
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that contains a Part Number inputText field and some other
I have strange situation - when I'm trying to update model, that can contains
I am trying to update a model that has translated content through globalize3 .
I have a User model. I am trying to update a confirm attribute from
UPDATE: Redefined what I am trying to do. I have a model of Contact,
I am trying to update a mongoose model. Having some difficulites. This is how
i'm trying to update a Model for GEF and have the changes shown in
I have a problem trying to update an attribute of one model using the
I am trying to update a nested has_one model using mongoid but it will
I'm trying to update one field of multiple records in a model, Lead. Each

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.