Class: DispatchesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- DispatchesController
- Defined in:
- lib/forge/app/controllers/dispatches_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#read ⇒ Object
2 3 4 5 6 7 8 |
# File 'lib/forge/app/controllers/dispatches_controller.rb', line 2 def read @dispatch = Dispatch.find(params[:id]) @dispatch.opens.create(:email => params[:email], :ip => request.env["HTTP_X_FORWARDED_FOR"]) File.open(File.join(Rails.root, 'public', 'pixel.gif'), 'rb') do |f| send_data f.read, :type => 'image/gif', :disposition => 'inline' end end |
#unsubscribe ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/forge/app/controllers/dispatches_controller.rb', line 10 def unsubscribe @dispatch = Dispatch.find(params[:id]) @subscriber = Subscriber.find_by_id_and_email!(params[:s_id], params[:email]) DispatchUnsubscribe.create(:dispatch => @dispatch, :email => @subscriber.email) @subscriber.destroy flash[:notice] = "You have been unsubscribed from our newsletter." redirect_to root_path end |