From 25881e38c8b15e14933cc8fda869722d973fb6a5 Mon Sep 17 00:00:00 2001 From: Valentin Vasilyev Date: Mon, 29 Dec 2014 13:29:38 +0300 Subject: [PATCH] Remove implicit ordering when searching existing row by constraint --- lib/seed-fu/seeder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/seed-fu/seeder.rb b/lib/seed-fu/seeder.rb index 0fc2b5e..2abfc54 100644 --- a/lib/seed-fu/seeder.rb +++ b/lib/seed-fu/seeder.rb @@ -76,7 +76,7 @@ def seed_record(data) 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