Skip to content

Commit

Permalink
add to README
Browse files Browse the repository at this point in the history
  • Loading branch information
funny-falcon committed Aug 4, 2010
1 parent 3e1201a commit c2b3fc1
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,36 @@ Then you should enable identity map for each model class individually:
use_id_map
belongs_to :tarif_plan
end

You can use identity map for all models by writing in initializer:

class ActiveRecord::Base
use_id_map
end

To enable in rake task or script:

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

or equivalently

Client.with_id_map do
# all things here goes with identity map
# not only for Client
end

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

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

Client.without_id_map do
# all things here goes without identity map
# not only for Client
end


Expand Down

0 comments on commit c2b3fc1

Please sign in to comment.