Such a thing in order to make the execution of a piece of code only in call one of its methods / properties. It is supposed to use instead of ActiveRecord::Relation in the absence thereof. In fact, this is a delegator to the results of the block.
# Gemfilegem'postponer'$ bundle
pry(main)> w=Postponer.defer{Story.first}=>#<Postponer::DelegateAll:0x007fa26c0e5658 @block=#<Proc:0x007fa26c0e5680@(irb):1>>There is not a SQL query execution
Now we try to execute something on the block result
pry(main)> w.estimateStoryLoad(0.7ms)SELECT"stories".* FROM"stories"ORDERBY"stories"."id"ASCLIMIT1=>1320and notice the SQL query execution.
Sometimes you need to permit the delegation of methods that can be invoked on the block
pry(main)> w=Postponer.defer(:estimate){Story.first}=>#<Postponer::DelegateSpecific:0x007fa26c0d4038 @block=#<Proc:0x007fa26c0d4060@(irb):2>>pry(main)> w.estimateStoryLoad(0.8ms)SELECT"stories".* FROM"stories"ORDERBY"stories"."id"ASCLIMIT1=>1320pry(main)> w.idNoMethodError: undefinedmethod`id' for #<Postponer::DelegateSpecific:0x007fa26c0d4038>from (pry):56:in `<main>'MIT.