From 2269f43eb36ceeacf29ab1996ae1d46b344cde86 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Fri, 4 Jan 2013 22:39:34 -0200 Subject: Move class method to instance in dbconsole This method doesn't need to be in the class, since it's only used only from the instance. --- railties/lib/rails/commands/console.rb | 1 + railties/lib/rails/commands/dbconsole.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'railties') diff --git a/railties/lib/rails/commands/console.rb b/railties/lib/rails/commands/console.rb index 35a9072f51..11275d7ea9 100644 --- a/railties/lib/rails/commands/console.rb +++ b/railties/lib/rails/commands/console.rb @@ -35,6 +35,7 @@ module Rails end private + def available_environments Dir[Rails.root.join('config', 'environments', '*.rb')].map { |fname| File.basename(fname, '.*') } end diff --git a/railties/lib/rails/commands/dbconsole.rb b/railties/lib/rails/commands/dbconsole.rb index 353a64fd01..2d1e2d6a45 100644 --- a/railties/lib/rails/commands/dbconsole.rb +++ b/railties/lib/rails/commands/dbconsole.rb @@ -136,7 +136,7 @@ module Rails if arguments.first && arguments.first[0] != '-' env = arguments.first - if self.class.available_environments.include? env + if available_environments.include? env options[:environment] = env else options[:environment] = %w(production development test).detect {|e| e =~ /^#{env}/} || env @@ -146,7 +146,7 @@ module Rails options end - def self.available_environments + def available_environments Dir[Rails.root.join('config', 'environments', '*.rb')].map { |fname| File.basename(fname, '.*') } end -- cgit v1.2.3