diff options
author | Jon Moss <me@jonathanmoss.me> | 2016-04-29 23:15:30 -0400 |
---|---|---|
committer | Jon Moss <me@jonathanmoss.me> | 2016-04-30 12:32:30 -0400 |
commit | 76f7da0c6516bed5d1375b5d55dde71ba71df4f7 (patch) | |
tree | 7b14d47a54d8414fe6bd0a70d672c8506d0ea3e2 | |
parent | 3458ad92a196983550f6d680ad1ae58bce386fde (diff) | |
download | rails-76f7da0c6516bed5d1375b5d55dde71ba71df4f7.tar.gz rails-76f7da0c6516bed5d1375b5d55dde71ba71df4f7.tar.bz2 rails-76f7da0c6516bed5d1375b5d55dde71ba71df4f7.zip |
Replace `Rails.version.to_f` with Active Record
Rails should not be explicity mentioned within Active Record, since
railties and the Rails ecosystem is not required for use.
-rw-r--r-- | activerecord/lib/active_record/migration.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/migration_test.rb | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 33c236a732..5dc7020944 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -528,7 +528,7 @@ module ActiveRecord end def self.current_version - Rails.version.to_f + ActiveRecord::VERSION::STRING.to_f end MigrationFilenameRegexp = /\A([0-9]+)_([_a-z0-9]*)\.?([_a-z0-9]*)?\.rb\z/ # :nodoc: diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index 5a6d2ce80c..a4b0de3f4e 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -69,6 +69,10 @@ class MigrationTest < ActiveRecord::TestCase ActiveRecord::Migration.verbose = @verbose_was end + def test_migration_version_matches_component_version + assert_equal ActiveRecord::VERSION::STRING.to_f, ActiveRecord::Migration.current_version + end + def test_migrator_versions migrations_path = MIGRATIONS_ROOT + "/valid" old_path = ActiveRecord::Migrator.migrations_paths |