Skip to content
Browse files

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.
  • Loading branch information...
1 parent 149b86d commit 2269f43eb36ceeacf29ab1996ae1d46b344cde86 @carlosantoniodasilva carlosantoniodasilva committed Jan 4, 2013
Showing with 3 additions and 2 deletions.
  1. +1 −0 railties/lib/rails/commands/console.rb
  2. +2 −2 railties/lib/rails/commands/dbconsole.rb
View
1 railties/lib/rails/commands/console.rb
@@ -35,6 +35,7 @@ def parse_arguments(arguments)
end
private
+
def available_environments
Dir[Rails.root.join('config', 'environments', '*.rb')].map { |fname| File.basename(fname, '.*') }
end
View
4 railties/lib/rails/commands/dbconsole.rb
@@ -136,7 +136,7 @@ def parse_arguments(arguments)
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 @@ def parse_arguments(arguments)
options
end
- def self.available_environments
+ def available_environments
Dir[Rails.root.join('config', 'environments', '*.rb')].map { |fname| File.basename(fname, '.*') }
end

0 comments on commit 2269f43

Please sign in to comment.
Something went wrong with that request. Please try again.