Class: Wco::UnsubscribesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Wco::UnsubscribesController
- Defined in:
- app/controllers/wco/unsubscribes_controller.rb
Overview
In order to have unsubscribes_url , unsubscribes must be in wco .
Instance Method Summary collapse
Methods inherited from ApplicationController
Methods included from ApplicationHelper
#my_truthy?, #obfuscate, #pp_amount, #pp_currency, #pp_date, #pp_datetime, #pp_money, #pp_percent, #pp_time, #pretty_date
Instance Method Details
#create ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/wco/unsubscribes_controller.rb', line 5 def create :open_permission, Wco @lead = Wco::Lead.find params[:lead_id] if( !params[:token] || @lead.unsubscribe_token != params[:token] ) render code: 400, message: "We're sorry, but something went wrong. Please try again later." return end @unsubscribe = WcoEmail::Unsubscribe.find_or_create_by({ lead_id: params[:lead_id], template_id: params[:template_id], campaign_id: params[:campaign_id], }) flag = @unsubscribe.update_attributes({ unsubscribed_at: Time.now, }) if flag flash_notice "You have been unsubscribed." else flash_alert "We're sorry, but something went wrong. Please try again later." end render layout: false end |
#index ⇒ Object
32 33 34 35 36 37 |
# File 'app/controllers/wco/unsubscribes_controller.rb', line 32 def index :index, WcoEmail::Unsubscribe @unsubscribes = WcoEmail::Unsubscribe.all render '_table' end |