-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Turned linkify_haarchion into a rake task
- Loading branch information
Showing
2 changed files
with
20 additions
and
17 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,20 @@ | ||
require 'csv' | ||
|
||
desc 'Import Haarchion audio links from CSV' | ||
task :linkify_haarchion, [:csv_file] => :environment do |taskname, args| | ||
lines = CSV.read(args.csv_file)[1..-1] # skip header row | ||
puts "Creating links for #{lines.size} records..." | ||
lines.each do |line| | ||
mid = line[4][line[4].rindex('/') + 1..-1] | ||
next if ExternalLink.exists?(url: line[5], linkable_id: mid, | ||
linkable_type: 'Manifestation') | ||
|
||
ExternalLink.create!(url: line[5], | ||
description: 'להקראת היצירה באתר הארכיון - ספרות עברית בקול', | ||
status: :approved, | ||
linktype: :audio, | ||
linkable_id: mid, | ||
linkable_type: 'Manifestation') | ||
end | ||
puts 'done.' | ||
end |
This file was deleted.
Oops, something went wrong.