Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

after saving the model, we set the primary key within the fixture has…

…h, in case it was not explicitly specified in the fixture and was generated by an auto_increment / serial field
  • Loading branch information...
commit da522b9fe42e91c1865ddd27b046a24edb3770f5 1 parent b7db5cc
Matthew Willson authored committed

Showing 1 changed file with 5 additions and 0 deletions. Show diff stats Hide diff stats

  1. +5 0 lib/fixture_dependencies.rb
5 lib/fixture_dependencies.rb
@@ -149,8 +149,13 @@ def use(record, loading = [], procs = {})
149 149 puts "#{spaces}#{record}.#{attr} = #{value.inspect}" if verbose > 2
150 150 obj.send("#{attr}=", value)
151 151 end
  152 +
152 153 puts "#{spaces}saving #{record}" if verbose > 1
  154 +
153 155 model_method(:model_save, mtype, obj)
  156 + # after saving the model, we set the primary key within the fixture hash, in case it was not explicitly specified in the fixture and was generated by an auto_increment / serial field
  157 + fixtures[model_name.to_sym][name.to_sym][model.primary_key.to_sym] ||= obj[model.primary_key.to_sym]
  158 +
154 159 loading.pop
155 160 # Update the circular references
156 161 if procs[record]

0 comments on commit da522b9

Please sign in to comment.
Something went wrong with that request. Please try again.