In the Rails 3 timeframe, I would like Rails to...

Add an identity map to ActiveRecord

Like in DataMapper.

151 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    anonymousanonymous shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    5 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Mario T. LanzaMario T. Lanza commented  ·   ·  Flag as inappropriate

        This is above all the greatest shortcoming to AR. It's almost a deal breaker and has me evaluating Sequel and other ORMs for an upcoming project. In one project I am working with highly intertwined database structures. The same records are frequently reloaded due to the way the business objects are navigated. Identity Map could solve this headache.

      • gregdgregd commented  ·   ·  Flag as inappropriate

        class Parent
        has_many :children
        end

        class Child
        belongs_to :parent
        validate_presence_of :parent_id
        end

        Now above simple code fails if parent and child records are created via nested forms (Rails 2.3 feature). I hope that with identity map, child records could have a reference to the parent object which exists only in memory. So validations like above and other non-trivial code also works.

      • Venkat KVenkat K commented  ·   ·  Flag as inappropriate

        I have AR objects which have parent child relationships (many are nested sets but even otherwise there are two or three level table relationships) this is becoming a important necessity

        Parental Kontrol could be one useful plugin to give some relieve onw

      • Luismi CavalléLuismi Cavallé commented  ·   ·  Flag as inappropriate

        I wasn't used to miss this functionality but lately I periodically get into advanced issues were i'd be really nice to have identity map in ActiveRecord. I also think some internals of ActiveRecord would be simplified and so further maintenance.

      • Otto HilskaOtto Hilska commented  ·   ·  Flag as inappropriate

        Not having an identity map forces me to write ugly hacks to avoid the performance problems.

      Feedback and Knowledge Base