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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:25:51+00:00 2026-05-12T21:25:51+00:00

I have an aggregated attribute which I want to be able ask about its

  • 0

I have an aggregated attribute which I want to be able ask about its _changed? ness, etc.

composed_of :range,
            :class_name => 'Range',
            :mapping => [ %w(range_begin begin), %w(range_end end)],
            :allow_nil => true

If I use the aggregation:

foo.range = 1..10

This is what I get:

foo.range                # => 1..10
foo.range_changed?       # NoMethodError
foo.range_was            # ditto
foo.changed              # ['range_begin', 'range_end']

So basically, I’m not getting ActiveRecord::Dirty semanitcs on aggregated attributes. Is there any way to do that? I’m not having a lot of luck with alias_attribute_with_dirty, etc.

  • 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-12T21:25:51+00:00Added an answer on May 12, 2026 at 9:25 pm

    You don’t get ActiveRecord::Dirty semantics because aggregated attributes are not association proxies, being mere wrappers for your actual attributes – that’s why you have no access to ActiveRecords goodness through them.

    Note, that foo.range_begin_changed? should work, so you may try to see if you can use foo.class#method_missing (e.g. defined in a module to be included) to automatically map *_was, *_changed? etc methods to those called on actual attributes of foo.class.

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

Sidebar

Related Questions

I have an aggregated data view in an MVC project which displays the totals
I'm using Drupal and I notice that if I have my CSS files aggregated
I have a database for which I need to aggregate records into another smaller
I have entity e.g. Product which aggregates other entities such as Category . Those
So how do you display complex aggregated ViewModels whose Models have relations to each
I have a server application that spins up and monitors about 8 separate processes
I have two tables which get updated at almost the exact same time -
In a report model I have some entities which have attributes which are integers
I have been learning about indexes in Oracle SQL, and I wanted to conduct
I have an aggregated table: > aggdata[1:4,] Group.1 Group.2 x 1 4 0.05 0.9214660

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.