Sha256: 14ea54bf0cfc6faa59e67fae163a54ab9f99a3593dafd4f867fddecb3315c8f0

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

IdentityMap
===========

Adds simple hand controlled identity map for ActiveRecord.

Installing
==========

    gem install ar-simple-identity-map

or


Enabling
========    
    
To enable in ApplicationController (it is not enabled by default).

    class ApplicationController < ActionController::Base
      use_identity_map #(installs around filter)
      # or use_identity_map :only=>[:index, :show]
      # or use_identity_map :except=>[:update]
    end
    
If you decide to disable filter in sub controllers:

    class ClientController < ApplicationController
      dont_use_identity_map :only=>[:save, :update, :messy_action]
    end

Then you should enable identity map for each model class individually:

    class TarifPlan < ActiveRecord::Base
      use_id_map
      has_many :clients
    end
    
    class Client < ActiveRecord::Base
      use_id_map
      belongs_to :tarif_plan
    end
    
To enable in rake task or script:

    ActiveRecord.with_id_map do
      # all things here goes with identity map
    end

If you found that identity logic does wrong thing in some particular place,
you could temporary disable it:

    ActiveRecord.without_id_map do
      # all things here goes without identity map
    end


Copyright
=========

inspired by http://github.com/pjdavis/identity-map
Copyright (c) 2010 Sokolov Yura aka funny_falcon, released under the MIT license.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ar-simple-idmap-0.1.0 README