Permalink
Browse files

Revert "Merge pull request #5995 from kennyj/fix_5847-3"

Active Record should be lazy loaded and this pull request
forced Active Record to always be loaded after initialization.

This reverts commit 8cd14c0, reversing
changes made to 2f0c8c5.
  • Loading branch information...
1 parent a6e47b2 commit 0a8aec2c97ab93721d5671555f22975da0a20422 @josevalim josevalim committed Apr 27, 2012
Showing with 0 additions and 27 deletions.
  1. +0 −5 activerecord/lib/active_record/railtie.rb
  2. +0 −22 railties/test/application/rake_test.rb
@@ -128,10 +128,5 @@ class Railtie < Rails::Railtie
end
end
-
- config.after_initialize do
- # We should load ActiveRecord::Base class before loading an application model.
- require "active_record/base"
- end
end
end
@@ -167,27 +167,5 @@ def test_rake_clear_schema_cache
end
assert !File.exists?(File.join(app_path, 'db', 'schema_cache.dump'))
end
-
- def test_load_activerecord_base_when_we_use_observers
- Dir.chdir(app_path) do
- `bundle exec rails g model user;
- bundle exec rake db:migrate;
- bundle exec rails g observer user;`
-
- add_to_config "config.active_record.observers = :user_observer"
-
- assert_equal "0", `bundle exec rails r "puts User.count"`.strip
-
- app_file "lib/tasks/count_user.rake", <<-RUBY
- namespace :user do
- task :count => :environment do
- puts User.count
- end
- end
- RUBY
-
- assert_equal "0", `bundle exec rake user:count`.strip
- end
- end
end
end

3 comments on commit 0a8aec2

Contributor

kennyj replied Apr 27, 2012

@josevalim If we revert my PR, the above testcase is passed (on master).

Maybe by d0bb43d, it seems taht the AR::Base is already loaded durring initialization.
Should we solve this problem ?

Contributor

josevalim replied Apr 27, 2012

Contributor

josevalim replied Apr 27, 2012

Please sign in to comment.