lib/seed-fu/seeder.rb in seed-fu-2.3.5 vs lib/seed-fu/seeder.rb in seed-fu-2.3.6
- old
+ new
@@ -74,10 +74,10 @@
record.save(:validate => false) || raise(ActiveRecord::RecordNotSaved, 'Record not saved!')
record
end
def find_or_initialize_record(data)
- @model_class.where(constraint_conditions(data)).first ||
+ @model_class.where(constraint_conditions(data)).take ||
@model_class.new
end
def constraint_conditions(data)
Hash[@constraints.map { |c| [c, data[c.to_sym]] }]