charlotte-ruby / impressionist

Rails Plugin that tracks impressions and page views
MIT License
1.54k stars 313 forks source link

How to create model callbacks? #291

Open karandocs opened 3 years ago

karandocs commented 3 years ago

I'm using active record ORM. Is there any way to create callbacks for impression model? I want to run a background job on after create callback.

codeundercoverdev commented 3 years ago

I need to do this as well. Has anyone been able to. I tried making a basic model like below but it seems to get ignored by Rails.

class Impression < ApplicationRecord
    belongs_to :thing, optional: true
end