Class: SluggerJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/slugger_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(*_args) ⇒ Object

Запоминаем короткую ссылку на источник, откуда будем восстанвливать


5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/jobs/slugger_job.rb', line 5

def perform(*_args)
  counter = 0

  begin
    Post.where(slug_id: nil).find_each do |post|
      post.update_attribute :slug_id, Archive.new.slug_id_for_post(post)
      counter += 1
    end
  rescue StandardError => ex
    EventTracker.track 'Jobs', 'Slugs added', nil, counter
    raise ex
  end
end