* Initial automatic cleanup with rubocop * Fix syntax error introduced by rubocop * Cleanup seeds file * Cleanup lib folder * Exclude bin folder because it contains auto generated files * Make Rubocop a little bit more chatty * Block length should not include comments in the count * Cleanup config folder * Cleanup specs * Updated Rubocop version and generated a todo file * Fix broken ArticlesApi spec * Fix tests * Restored rubocop pre-commit hook
32 lines
513 B
Ruby
32 lines
513 B
Ruby
class Podcast < ApplicationRecord
|
|
has_many :podcast_episodes
|
|
|
|
mount_uploader :image, ProfileImageUploader
|
|
mount_uploader :pattern_image, ProfileImageUploader
|
|
|
|
after_save :bust_cache
|
|
after_create :pull_all_episodes
|
|
|
|
def path
|
|
slug
|
|
end
|
|
|
|
def profile_image_url
|
|
image_url
|
|
end
|
|
|
|
def name
|
|
title
|
|
end
|
|
|
|
private
|
|
|
|
def bust_cache
|
|
CacheBuster.new.bust("/" + path)
|
|
end
|
|
|
|
def pull_all_episodes
|
|
PodcastFeed.new.get_episodes(self)
|
|
end
|
|
handle_asynchronously :pull_all_episodes
|
|
end
|