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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:31:55+00:00 2026-05-26T11:31:55+00:00

Table: Raw_Data Fields: id name Table: Actual_Data Fields: id raw_data_id name A use can

  • 0

Table: Raw_Data
Fields: id
name

Table: Actual_Data
Fields: id
raw_data_id
name

A use can either add data manually to Actual_Data (in which case it’s raw_data_id is NULL) or they can select a Raw_Data to insert into Actual_Data (in which case it’s raw_data_id is set).

Is the following relationships correct in this case?

For Raw_Data:
-none-

For Actual_Data:
has_one :raw_data

  • 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-26T11:31:56+00:00Added an answer on May 26, 2026 at 11:31 am

    You are right the relationship should be the same as you said,

    class ActualDate < ActiveRecord::Base
      has_one :raw_data
    end
    
    class RawData < ActiveRecord::Base
      belong_to :actual_data
    end
    

    As per the rails convention, the foreign key should belongs to the table which has belongs_to association, so here actual_data_id should be in raw_datas table.

    Edit:
    We don’t need raw_data_id in actual_datas table.

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

Sidebar

Related Questions

I have a table Classes, which stores data on different college classes (a unique
Just wondering which is best here. I want to output data from a table
table data of 2 columns category and subcategory i want to get a collection
table { id: long name: string } 1235 Fred 1902 Trever 5123 George 6467
I want to export data from a table to a specifically formatted XML file.
I have a raw form-data that look like this: ------------V2ymHFg03ehbqgZCaKO6jy Content-Disposition: form-data; name=intro O
I have a collection of rows, I can generate Table(HTML) out of it using
I am importing raw data in groovy, hundreds of thousands of entries. I use
Due to performance reasons I can't use the ORM query methods of Django and
I have a set of tables in SQL Server 2005 which contain timeseries data.

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.