Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom After_Commit callback when activities are created #370

Open
thejbix opened this issue Jun 20, 2022 · 2 comments
Open

Custom After_Commit callback when activities are created #370

thejbix opened this issue Jun 20, 2022 · 2 comments
Assignees

Comments

@thejbix
Copy link

thejbix commented Jun 20, 2022

I'd like to access an after_commit callback to run custom code when an activity has been created. How can this be done?

The purpose for this is I'd like to send updates or alerts when an activity is created/updated/ or destroyed.

Using Rails 7

@thejbix
Copy link
Author

thejbix commented Jun 20, 2022

Is it possible to have a model extend PublicActivity::Activity

class Activity < PublicActivity::Activity
  after_commit :base_after_commit

  def base_after_commit
    puts "After Commit for PublicActivity"
  end
end

And have PublicActivity use this new model by default instead of PublicActivity::Activity ?

@ur5us ur5us self-assigned this Jun 22, 2022
@ur5us
Copy link
Collaborator

ur5us commented Jun 22, 2022

@thejbix This has been address in the following PR: #154. However, that PR needs work, i.e. rebasing. I haven’t had the time myself yet but feel free to take a stab at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants