aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/object/with_options.rb
diff options
context:
space:
mode:
authorFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-09-12 13:46:33 -0500
committerFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-09-12 13:47:49 -0500
commitf4e180578c673194f58d4ff5a4a656cc51b2249e (patch)
treec1004a8c06730d9cea9f5dd0e5837f95f7713258 /activesupport/lib/active_support/core_ext/object/with_options.rb
parent961355a9f34a9cdb3001d8a4b69741408145ebb8 (diff)
downloadrails-f4e180578c673194f58d4ff5a4a656cc51b2249e.tar.gz
rails-f4e180578c673194f58d4ff5a4a656cc51b2249e.tar.bz2
rails-f4e180578c673194f58d4ff5a4a656cc51b2249e.zip
update some AS code examples to 1.9 hash syntax [ci skip]
Diffstat (limited to 'activesupport/lib/active_support/core_ext/object/with_options.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/object/with_options.rb15
1 files changed, 7 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/with_options.rb b/activesupport/lib/active_support/core_ext/object/with_options.rb
index e058367111..42e388b065 100644
--- a/activesupport/lib/active_support/core_ext/object/with_options.rb
+++ b/activesupport/lib/active_support/core_ext/object/with_options.rb
@@ -10,16 +10,16 @@ class Object
# Without <tt>with_options></tt>, this code contains duplication:
#
# class Account < ActiveRecord::Base
- # has_many :customers, :dependent => :destroy
- # has_many :products, :dependent => :destroy
- # has_many :invoices, :dependent => :destroy
- # has_many :expenses, :dependent => :destroy
+ # has_many :customers, dependent: :destroy
+ # has_many :products, dependent: :destroy
+ # has_many :invoices, dependent: :destroy
+ # has_many :expenses, dependent: :destroy
# end
#
# Using <tt>with_options</tt>, we can remove the duplication:
#
# class Account < ActiveRecord::Base
- # with_options :dependent => :destroy do |assoc|
+ # with_options dependent: :destroy do |assoc|
# assoc.has_many :customers
# assoc.has_many :products
# assoc.has_many :invoices
@@ -29,14 +29,13 @@ class Object
#
# It can also be used with an explicit receiver:
#
- # I18n.with_options :locale => user.locale, :scope => 'newsletter' do |i18n|
+ # I18n.with_options locale: user.locale, scope: 'newsletter' do |i18n|
# subject i18n.t :subject
- # body i18n.t :body, :user_name => user.name
+ # body i18n.t :body, user_name: user.name
# end
#
# <tt>with_options</tt> can also be nested since the call is forwarded to its receiver.
# Each nesting level will merge inherited defaults in addition to their own.
- #
def with_options(options)
yield ActiveSupport::OptionMerger.new(self, options)
end