From bdc62d6a5be08ed96002e388bdd0e1dab7acad43 Mon Sep 17 00:00:00 2001 From: Brian Riley Date: Fri, 27 Oct 2017 14:08:59 -0700 Subject: [PATCH] fixed issue with seeds.rb --- db/seeds.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index fabb9a8328..1c6d5532fb 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -368,10 +368,19 @@ org: Org.find_by(abbreviation: 'GA'), is_default: false, version: 0, - migrated:false, + migrated: false, dmptemplate_id: 3} ] -templates.map{ |t| Template.create!(t) if Template.find_by(title: t[:title]).nil? } +# Template creation calls defaults handler which sets is_default and +# published to false automatically, so update them after creation +templates.map do |t| + if Template.find_by(title: t[:title]).nil? + tmplt = Template.create!(t) + tmplt.published = t[:published] + tmplt.is_default = t[:is_default] + tmplt.save! + end +end # Create 2 phases for the funder's template and one for our generic template # -------------------------------------------------------