Change fixed organization id to fixed organization slug (#15067)
* Remove hard coded organization id from seed Since we create (hopefully) an organization with a known slug, use find_by here to set the organization_id on the seeded DisplayAd. * Since the DisplayAd looks by slug, create org if slug not found Change the seed guard to ensure an organization with slug "bachmanity" is present - we'll find by slug in DisplayAd (rather than assuming this is id 1).
This commit is contained in:
parent
82a0035e8c
commit
3167ff44d7
1 changed files with 3 additions and 2 deletions
|
|
@ -88,7 +88,7 @@ end
|
|||
|
||||
##############################################################################
|
||||
|
||||
seeder.create_if_none(Organization) do
|
||||
seeder.create_if_doesnt_exist(Organization, "slug", "bachmanity") do
|
||||
organization = Organization.create!(
|
||||
name: "Bachmanity",
|
||||
summary: Faker::Company.bs,
|
||||
|
|
@ -626,8 +626,9 @@ end
|
|||
##############################################################################
|
||||
|
||||
seeder.create_if_none(DisplayAd) do
|
||||
org_id = Organization.find_by(slug: "bachmanity").id
|
||||
DisplayAd.create!(
|
||||
organization_id: 1,
|
||||
organization_id: org_id,
|
||||
body_markdown: "<h1>This is an add</h1>",
|
||||
placement_area: "sidebar_left",
|
||||
published: true,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue