Closed veronicar239 closed 5 years ago
This is a good suggestion. I replaced associations to platform IDs 3 (Diving - Technical...) and 6 (Diving - Regular...) with an association to ID 1 (Diving - unspecified) with the code below. And then renamed that category (ID 1) to "SCUBA (open-circuit or unspecified), and the rebreather category (ID 4) to "Rebreather" (for now). Platform IDs 3 and 6 are removed.
[3,6].each do |i|
Platform.find(i).publications.each do |publication|
puts "Updating #{publication.id}:#{publication.title}"
# Delete association
association_to_be_deleted = publication.platforms.find(i)
publication.platforms.delete(association_to_be_deleted)
# Replace with new association
publication.platforms << Platform.find(1)
end
end
@pimbongaerts For purpose of stats page:
This will be used to differentiate between 'Diving - open circuit' and 'Diving - rebreather' tags for the platform types in the summary statistics page.