diff options
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/application.rb | 3 | ||||
-rw-r--r-- | railties/lib/rails/commands/console.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/console/sandbox.rb | 6 | ||||
-rw-r--r-- | railties/lib/rails/railtie.rb | 4 |
4 files changed, 3 insertions, 14 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 4e82761e5d..dd01bbab1d 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -112,7 +112,7 @@ module Rails def load_console(sandbox=false) initialize_console(sandbox) - railties.all { |r| r.load_console } + railties.all { |r| r.load_console(sandbox) } super() self end @@ -196,7 +196,6 @@ module Rails def initialize_console(sandbox=false) require "rails/console/app" - require "rails/console/sandbox" if sandbox require "rails/console/helpers" end end diff --git a/railties/lib/rails/commands/console.rb b/railties/lib/rails/commands/console.rb index dfd3c654ff..66dbb5d11e 100644 --- a/railties/lib/rails/commands/console.rb +++ b/railties/lib/rails/commands/console.rb @@ -34,10 +34,6 @@ module Rails exit end end - - if defined?(ActiveRecord) - ActiveRecord::Base.logger = Logger.new(STDERR) - end if options[:sandbox] puts "Loading #{Rails.env} environment in sandbox (Rails #{Rails.version})" diff --git a/railties/lib/rails/console/sandbox.rb b/railties/lib/rails/console/sandbox.rb deleted file mode 100644 index 65a3d68619..0000000000 --- a/railties/lib/rails/console/sandbox.rb +++ /dev/null @@ -1,6 +0,0 @@ -ActiveRecord::Base.connection.increment_open_transactions -ActiveRecord::Base.connection.begin_db_transaction -at_exit do - ActiveRecord::Base.connection.rollback_db_transaction - ActiveRecord::Base.connection.decrement_open_transactions -end diff --git a/railties/lib/rails/railtie.rb b/railties/lib/rails/railtie.rb index 7fca565124..b183eb8ddd 100644 --- a/railties/lib/rails/railtie.rb +++ b/railties/lib/rails/railtie.rb @@ -173,8 +173,8 @@ module Rails def eager_load! end - def load_console - self.class.console.each(&:call) + def load_console(sandbox=false) + self.class.console.each { |block| block.call(sandbox) } end def load_tasks |