README.md in n1_loader-1.4.2 vs README.md in n1_loader-1.4.3

- old
+ new

@@ -29,15 +29,35 @@ ``` You can add integration with [ActiveRecord][5] by: ```ruby gem 'n1_loader', require: 'n1_loader/active_record' + +# You also may be interested in injecting it to models +class ActiveRecord::Base + include N1Loader::Loadable + + def reload(*) + n1_clear_cache + super + end +end ``` You can add the integration with [ActiveRecord][5] and [ArLazyPreload][6] by: ```ruby gem 'n1_loader', require: 'n1_loader/ar_lazy_preload' + +# You also may be interested in injecting it to models +class ActiveRecord::Base + include N1Loader::Loadable + + def reload(*) + n1_clear_cache + super + end +end ``` ## Usage ```ruby @@ -218,10 +238,10 @@ ```ruby class User include N1Loader::Loadable n1_optimized :orders_count do - argument :sale + argument :sale, optional: true, default: -> { Sale.last } cache_key { sale.id } def perform(users) orders_per_user = Order.where(sale: sale, user: users).group(:user_id).count \ No newline at end of file