Skip to content

Instantly share code, notes, and snippets.

@bricker
Created October 8, 2012 17:42
Show Gist options
  • Save bricker/3853833 to your computer and use it in GitHub Desktop.
Save bricker/3853833 to your computer and use it in GitHub Desktop.
class Audio < ActiveRecord::Base
def self.sync!
[Audio::ProgramAudio, Audio::DirectAudio, Audio::EncoAudio].each do |klass|
klass.sync!
end
end
class EncoAudio < Audio
def self.sync!
sync_awaiting_audio_if_file_exists!
end
end
class ProgramAudio < Audio
def self.sync!
# do other stuff
end
end
class DirectAudio < Audio
def self.sync!
sync_awaiting_audio_if_file_exists!
end
end
class UploadedAudio < Audio
# no sync method
end
class << self
private
def sync_awaiting_audio_if_file_exists!
# check if file exists and set audio
end
end
#
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment