-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rake task to create popular links and links to homepage
- Loading branch information
1 parent
f67d862
commit 715633b
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
desc "Create popular links and links to homepage" | ||
task create_popular_links_and_link_to_homepage: [:environment] do | ||
homepage_content_id = "f3bbdec2-0e62-4520-a7fd-6ffd5d36e03a".freeze | ||
popular_links = PopularLinksEdition.new(title: "Homepage popular links", | ||
link_items: [{ url: "url1.com", title: "title1" }, | ||
{ url: "url2.com", title: "title2" }, | ||
{ url: "url3.com", title: "title3" }, | ||
{ url: "url4.com", title: "title4" }, | ||
{ url: "url5.com", title: "title5" }, | ||
{ url: "url6.com", title: "title6" }]) | ||
|
||
popular_links.save! | ||
|
||
Services.publishing_api.patch_links( | ||
homepage_content_id, | ||
links: { | ||
"popular_links" => [popular_links.content_id], | ||
}, | ||
) | ||
rescue StandardError => e | ||
puts "Encountered error #{e.message}" | ||
end |