Permalink
Browse files

Replace deprecated Kernel#returning method

To avoid deprecation warnings in Rails 2.3.10 (and others),
replace call to Kernel#returning with call to Object#tap.
  • Loading branch information...
jrdioko committed Jan 12, 2011
1 parent b0a5d2b commit 7affa109cf86f774c9a6a4addf7a46f90764907a
Showing with 2 additions and 2 deletions.
  1. +2 −2 init.rb
View
@@ -1,7 +1,7 @@
class << ActiveRecord::Base
def belongs_to_with_deleted(association_id, options = {})
with_deleted = options.delete :with_deleted
- returning belongs_to_without_deleted(association_id, options) do
+ belongs_to_without_deleted(association_id, options).tap do
if with_deleted
reflection = reflect_on_association(association_id)
association_accessor_methods(reflection, Caboose::Acts::BelongsToWithDeletedAssociation)
@@ -13,7 +13,7 @@ def belongs_to_with_deleted(association_id, options = {})
def has_many_without_deleted(association_id, options = {}, &extension)
with_deleted = options.delete :with_deleted
- returning has_many_with_deleted(association_id, options, &extension) do
+ has_many_with_deleted(association_id, options, &extension).tap do
if options[:through] && !with_deleted
reflection = reflect_on_association(association_id)
collection_reader_method(reflection, Caboose::Acts::HasManyThroughWithoutDeletedAssociation)

0 comments on commit 7affa10

Please sign in to comment.