Class: Admin::MailchimpController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::MailchimpController
- Includes:
- Effective::CrudController
- Defined in:
- app/controllers/admin/mailchimp_controller.rb
Instance Method Summary collapse
-
#index ⇒ Object
/admin/mailchimp.
-
#mailchimp_sync ⇒ Object
Sync All.
-
#mailchimp_sync_user ⇒ Object
Sync one user.
Instance Method Details
#index ⇒ Object
/admin/mailchimp
11 12 |
# File 'app/controllers/admin/mailchimp_controller.rb', line 11 def index end |
#mailchimp_sync ⇒ Object
Sync All
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/admin/mailchimp_controller.rb', line 15 def mailchimp_sync EffectiveResources.(self, :admin, :mailchimp_sync) api = EffectiveMailchimp.api Effective::MailchimpList.sync!(api: api) Effective::MailchimpCategory.sync!(api: api) Effective::MailchimpInterest.sync!(api: api) flash[:success] = "Successfully synced mailchimp data" redirect_back(fallback_location: effective_mailchimp.admin_mailchimp_path) end |
#mailchimp_sync_user ⇒ Object
Sync one user
29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/admin/mailchimp_controller.rb', line 29 def mailchimp_sync_user resource = current_user.class.find(params[:id]) EffectiveResources.(self, :update, resource) resource.mailchimp_sync! flash[:success] = "Successfully synced mailchimp" redirect_back(fallback_location: "/admin/users/#{params[:id]}/edit") end |