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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:34:25+00:00 2026-06-01T08:34:25+00:00

In my model I have three complex scopes returning the Discount object arrays. Each

  • 0

In my model I have three complex scopes returning the Discount object arrays. Each of these can overlap, and I want to do some Ruby array union/intersection/substraction operations.

I guess these operations depend on the object id. I am wondering if Discount queries will return the same record as the same object when it is through different scopes. In my program those will be done during the same request.

UPDATE:

I was wrong, twice. Each objects returned are truly different objects. And though they are different, the union/intersection/substraction operations still works correctly.

  • 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-01T08:34:26+00:00Added an answer on June 1, 2026 at 8:34 am

    By default no – you’ll get two objects representing the same database row. Check the object_id if you need convincing.

    In Rails 3.1 and above you can turn on the identity map. This ensures that inside a given request a single row in the database will always be represented by a single ruby object. There are still some kinks in it, which is why it isn’t on by default.

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

Sidebar

Related Questions

I have three model classes that look as below: class Model(models.Model): model = models.CharField(max_length=20,
Let's assume I have a model called product. Let's assume that product has three
I've encountered some problems with MongoID. I have three models: require 'mongoid' class Configuration
I have a model that has several properties. The properties can be primitive (String)
I want to be able to do the following: I have a model and
I have an object with has multiple similar complex properties. I would like to
I have a Job model that belongs_to three users (customer, employee, and qa). The
I am familiar with three layers viz. view model & controller. Now i want
I have a fairly complex page model. On one of my pages I have
If I have a fairly complex User model that I would like to use

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.