Search code examples
emailruby-on-rails-4activeadminmailerbulk-email

ActiveAdmin batch email


I started using active admin for a little Rails 4.2.0 app for the administrative backend, and I am trying to send batch emails. I can not find in the documentation how to do so( Maybe I am looking in the wrong places). I have already a mailer working on the "non-admin" views using Mandrill. The app is already deployed in Heroku and all works.

I am using on my Gemfile

gem 'activeadmin', github: 'activeadmin'

My admin/user.rb looks like this:

ActiveAdmin.register User do
  permit_params :email
                :encrypted_password
                :reset_password_token
                :reset_password_sent_at
                :remember_created_at
                :sign_in_count
                :current_sign_in_at
                :last_sign_in_at
                :current_sign_in_ip
                :last_sign_in_ip
                :created_at
                :updated_at
                :username
                :first_name
                :last_name

And I have also a very simple ContactController that has the actions new_contact and create_contact in order to send the emails out.

I also posted this question on ActiveAdmin Google Groups.

Any ideas on how to implement batch emails from ActiveAdmin? Can this be done?


Solution

  • After digging for a while on ActiveAdmin source controllers, I came out with this. It may not be the most elegant solution, but it works. Please notice that I am Not using my original ContactController, instead I am using the ActiveAdmin controller to send the emails.

    Here is a link to the gist: Send batch emails ActiveAdmin Rails 4.2.0

    I hope that it helps someone.