I need to send an email whenever the admin add a comment to a user. I am using active admin 0.4.3

How can I get this event and send email. When I post a comment, In my console I can see the following actions performed
Started POST "/admin/comments"
Redirected to http://localhost:3000/admin/comments/182
Started GET "/admin/comments/182"
Started GET "/admin/accounts/227"
I dont know how to access these functions. Please help.
I got it working by adding this code into your config/initializers/...
module ActiveAdmin
class Comment < ActiveRecord::Base
after_create :send_email
def send_email
AdminMailer.comment_created(self.id).deliver
end
end
end
Please mind that you have to write the AdminMailer and that we only pass the id because our mailer uses redis to send the mail asynchronous. If you don't have this you can pass the object.
I tried to overwrite the create action of the Admin::CommentsController in the same way but it didn't work. It would be much nicer to have this in the controller because sending an email is more a business of the controller than of the model. Any ideas how to do this?
...ok...commented on an active admin issue which adresses the same question and got some good answers...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With