Sha256: 7229708981ad894135a4df74b643a7e1012b3e9fca89e7ee23b2a918cbf8cd00

Contents?: true

Size: 872 Bytes

Versions: 6

Compression:

Stored size: 872 Bytes

Contents

module MailManager
  class MessagesController < ApplicationController
    layout 'admin'
    before_filter :find_message, :except => [:new,:create,:index]
    before_filter :find_mailing

    def index
      params[:message] = Hash.new unless params[:message]
      params[:message][:status] = 'failed' if params[:message][:status].nil?
      search_params = params[:message].merge(:mailing_id => params[:mailing_id]) 
      @valid_statuses = Message.valid_statuses
      @messages = Message.search(search_params).paginate(:page => params[:page])
    end

    def show
    end
  
    protected
  
    def find_message
      @message = Message.find(params[:id])
    end

    def find_mailing
      return @mailing = Mailing.find_by_id(params[:mailing_id]) if params[:mailing_id]
      return @mailing = @message.message.try(:mailing) if @message
      nil
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mail_manager-3.0.0 app/controllers/mail_manager/messages_controller.rb
mail_manager-0.1.4 app/controllers/mail_manager/messages_controller.rb
mail_manager-0.1.2 app/controllers/mail_manager/messages_controller.rb
mail_manager-0.1.1 app/controllers/mail_manager/messages_controller.rb
mail_manager-0.1.0 app/controllers/mail_manager/messages_controller.rb
mail_manager-0.0.1 app/controllers/mail_manager/messages_controller.rb