thingspeak/app/jobs/clear_channel_job.rb
2014-02-17 12:05:39 -05:00

15 lines
334 B
Ruby

class ClearChannelJob
@queue = :clear_channel
def self.perform(channel_id)
Feed.delete_all(["channel_id = ?", channel_id])
DailyFeed.delete_all(["channel_id = ?", channel_id])
if channel = Channel.find(channel_id)
channel.last_entry_id = nil
channel.clearing = false
channel.save
end
end
end