diff options
author | Prathamesh Sonpatki <csonpatki@gmail.com> | 2015-01-06 14:54:41 +0530 |
---|---|---|
committer | Prathamesh Sonpatki <csonpatki@gmail.com> | 2015-01-06 17:15:39 +0530 |
commit | 8da936a5d370aa2616ef532e1b65a32c514f518d (patch) | |
tree | 20fd4a6b68273bc253c345394cad133f33fcacc1 /activerecord/lib | |
parent | de4f40826e3b979735e4f3287725f1a7a3820818 (diff) | |
download | rails-8da936a5d370aa2616ef532e1b65a32c514f518d.tar.gz rails-8da936a5d370aa2616ef532e1b65a32c514f518d.tar.bz2 rails-8da936a5d370aa2616ef532e1b65a32c514f518d.zip |
Fix lookup of fixtures with non-string label
- Fixtures with non-string labels such as integers should be accessed
using integer label as key. For eg. pirates(1) or pirates(42).
- But this results in NotFound error because the label is converted into string before
looking up into the fixtures hash.
- After this commit, the label is converted into string only if its a
symbol.
- This issue was fount out while adding a test case for
https://github.com/rails/rails/commit/7b910917.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/fixtures.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 5f6a75ebef..10e9be20b5 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -882,7 +882,7 @@ module ActiveRecord @fixture_cache[fs_name] ||= {} instances = fixture_names.map do |f_name| - f_name = f_name.to_s + f_name = f_name.to_s if f_name.is_a?(Symbol) @fixture_cache[fs_name].delete(f_name) if force_reload if @loaded_fixtures[fs_name][f_name] |