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

  • Home
  • SEARCH
  • 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 805853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:09:18+00:00 2026-05-15T00:09:18+00:00

It seems when I grab some hierarchical ActiveRecord structure that there are quite a

  • 0

It seems when I grab some hierarchical ActiveRecord structure that there are quite a few hits to the database. I improved this using the :include option to flesh out as much of the structure as possible. Even so, it seems that ActiveRecord does not map the reciprocal sides of a relationship (e.g. parent-child) with unique references to a record. That is, we get a navigable ActiveRecord structure, but one that to my knowledge doesn’t guarantee a unique copy of a given record.

node = Node.find(1, :include => {:document => :node})
node.object_id #A
node.document.node.object_id #B although I expect/desire A

Unavoidable in ActiveRecord? Have others moved to alternative ORMs because of shortcomings like this? (Don’t get me wrong: ActiveRecord is a great tool. But all tools have strengths and weaknesses.)

Say I were to write my own SQL query (it could even be a stored proc) returning multiple result sets (one per table) containing all the relevant data for my ActiveRecord hierarchy. Is there a painless way that I can explicitly map the associations without having ActiveRecord mistaking my explicit mappings for an attempt to create new associations?

  • 1 1 Answer
  • 1 View
  • 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-15T00:09:18+00:00Added an answer on May 15, 2026 at 12:09 am

    I simply don’t think ActiveRecord is designed to support this idea. It simply means you have to work with ActiveRecord, understanding its pros and cons. I’ve since found ways to work around this issue.

    I’ve looked at DataMapper and I see that it does specifially address this issue:

    One row in the database
    should equal one object reference.
    Pretty simple idea. Pretty profound
    impact. If you run the following code
    in ActiveRecord you’ll see all false
    results. Do the same in DataMapper and
    it’s true all the way down…

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

Sidebar

Related Questions

Seems that This will be an easy question for you but this problem is
Seems like there should be... Right now it just seems like magic that you
So I'm using this pretty standard jquery plugin pattern whereby you can grab an
I need LINQ to grab a whole table, but this seems not to be
I'm gratefully using the ZipArchive library but it seems there is a memory leak.
I have some weird behaviour in Qt that seems like a defect. I'd like
I am using jQuery to grab some JSON and then plug it into some
I'm trying to use R to grab some web data that requires OAuth authentication.
I'm using node.js to make a call to redis to grab some data. The
I have some values that grab off an API and store them into an

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.