Ticket #3363: 3363_binary_in_yaml_fixtures.diff
| File 3363_binary_in_yaml_fixtures.diff, 0.9 kB (added by jamie@bravenet.com, 4 years ago) |
|---|
-
activerecord/lib/active_record/fixtures.rb
old new 293 293 if yaml = YAML::load(erb_render(IO.read(yaml_file_path))) 294 294 yaml = yaml.value if yaml.respond_to?(:type_id) and yaml.respond_to?(:value) 295 295 yaml.each do |name, data| 296 # Convert any binary fixtures to correct value before placing in database. 297 # Requires that the database field is binary-safe if binary fixtures are used. 298 data.each do |key, val| 299 if val.kind_of? YAML::Syck::PrivateType and val.type_id == 'binary' 300 data[key] = Base64.decode64(val.value) 301 end 302 end 296 303 self[name] = Fixture.new(data, @class_name) 297 304 end 298 305 end