1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Use yield instead block argument.

This commit is contained in:
Emilio Tagua 2010-09-13 14:59:09 -03:00
parent fa11c60b44
commit f0eaf11c0e

View file

@ -11,19 +11,19 @@ module ActiveRecord
repositories[current_repository_name] ||= Weakling::WeakHash.new
end
def with_repository(name = :default, &block)
def with_repository(name = :default)
old_repository = self.current_repository_name
self.current_repository_name = name
block.call(current)
yield if block_given?
ensure
self.current_repository_name = old_repository
end
def without(&block)
def without
old, self.enabled = self.enabled, false
block.call
yield if block_given?
ensure
self.enabled = old
end