namespace :db do
desc 'Cleans artist-album-track relations clean'
task :cleanup => :environment do
albums = Album.all
albums.each do |album|
if album.artist.nil?
album.delete
end
tracks = Track.all
tracks.each do |track|
if track.album.nil?
track.delete