Ruby on Rails Tuesday, April 26, 2016

Let me explain the purpose for this job. I'm trying to remove orphan
hashtags that aren't being used anymore (destroyed posts) This job would
run once every month to clean out the database. I'm currently receiving
variable/method undefined for hashtaggable_ids. The code that I wrote is

class RemoveHashtagOrphans < ActiveJob::Base
queue_as :default

def perform(hashtaggable_id)
hashtags = SimpleHashtag::Hashtag.find(hashtaggables:
orphans = {|h| h.hashtaggables.size == 0}

Original self.clean_orphan method below

def self.clean_orphans # From DB
# TODO Make this method call a single SQL query
orphans = { |h| h.hashtaggables.size == 0 }

I need to take the clean_orphan method and convert it into a sidekiq

Posted via

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment