Skip to content

Commit

Permalink
Don't break configurations.each, .first before the deprecation period
Browse files Browse the repository at this point in the history
  • Loading branch information
Joey Marianer committed Jul 25, 2019
1 parent ff62563 commit 9552878
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions activerecord/lib/active_record/database_configurations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,19 @@ def empty?
end
alias :blank? :empty?

def each
throw_getter_deprecation(:each)
configurations.each { |config|
yield [config.env_name, config.config]
}
end

def first
throw_getter_deprecation(:first)
config = configurations.first
[config.env_name, config.config]
end

private
def env_with_configs(env = nil)
if env
Expand Down Expand Up @@ -174,9 +187,6 @@ def merge_url_with_configs(url, configs)

def method_missing(method, *args, &blk)
case method
when :each, :first
throw_getter_deprecation(method)
configurations.send(method, *args, &blk)
when :fetch
throw_getter_deprecation(method)
configs_for(env_name: args.first)
Expand Down

0 comments on commit 9552878

Please sign in to comment.