From 91871f25f01f6b5d67e7da4aeb6dec0fae7b18fe Mon Sep 17 00:00:00 2001 From: Cody Fauser Date: Sun, 21 Sep 2008 19:01:48 -0400 Subject: Improve explanation of with_options --- activesupport/lib/active_support/core_ext/object/misc.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/object/misc.rb b/activesupport/lib/active_support/core_ext/object/misc.rb index 99b4a71645..cd0a04d32a 100644 --- a/activesupport/lib/active_support/core_ext/object/misc.rb +++ b/activesupport/lib/active_support/core_ext/object/misc.rb @@ -40,7 +40,11 @@ class Object value end - # An elegant way to refactor out common options + # An elegant way to factor duplication out of options passed to a series of + # method calls. Each method called in the block, with the block variable as + # the receiver, will have its options merged with the default +options+ hash + # provided. Each method called on the block variable must take an options + # hash as its final argument. # # with_options :order => 'created_at', :class_name => 'Comment' do |post| # post.has_many :comments, :conditions => ['approved = ?', true], :dependent => :delete_all -- cgit v1.2.3