Need help with creating a Sidekiq Job

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_orphans 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_orphans method and convert it into a sidekiq

David W. wrote in post #1183093:

These lines of code are working

orphans = {|h| h.hashtaggables.size ==

But, in order for the perform method to fire off. You need an argument
to go along with it.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs