diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-05-18 20:01:06 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-05-18 20:01:06 -0300 |
commit | 1cc44599397e061901cd59233397129625839a60 (patch) | |
tree | 235108ce6a9d270bdfe3264a8f5f5a7c99c3ae5c /activerecord/lib/active_record/fixtures.rb | |
parent | 3db44e938fc6b5a5d272c4df4cf06dd6b5715782 (diff) | |
parent | ee5520a0a5ea83843ce88f6b9550e3c36b8cdd49 (diff) | |
download | rails-1cc44599397e061901cd59233397129625839a60.tar.gz rails-1cc44599397e061901cd59233397129625839a60.tar.bz2 rails-1cc44599397e061901cd59233397129625839a60.zip |
Merge commit 'rails/master'
Conflicts:
activerecord/lib/active_record.rb
Updated:
Arel submodule
Diffstat (limited to 'activerecord/lib/active_record/fixtures.rb')
-rw-r--r-- | activerecord/lib/active_record/fixtures.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index e30fcf9a4f..721114d9d0 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -1,6 +1,7 @@ require 'erb' require 'yaml' require 'csv' +require 'zlib' require 'active_support/dependencies' require 'active_support/test_case' require 'active_support/core_ext/logger' @@ -434,6 +435,7 @@ end # Any fixture labeled "DEFAULTS" is safely ignored. class Fixtures < (RUBY_VERSION < '1.9' ? YAML::Omap : Hash) + MAX_ID = 2 ** 31 - 1 DEFAULT_FILTER_RE = /\.ya?ml$/ @@all_cached_fixtures = {} @@ -525,11 +527,10 @@ class Fixtures < (RUBY_VERSION < '1.9' ? YAML::Omap : Hash) cached_fixtures(connection, table_names) end - # Returns a consistent identifier for +label+. This will always - # be a positive integer, and will always be the same for a given - # label, assuming the same OS, platform, and version of Ruby. + # Returns a consistent, platform-independent identifier for +label+. + # Identifiers are positive integers less than 2^32. def self.identify(label) - label.to_s.hash.abs + Zlib.crc32(label.to_s) % MAX_ID end attr_reader :table_name, :name |