Sha256: 3aeac2587589c804a9aadbf5ec1893575d3d6fad1e15178076913f2ec8af51b4

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

module Softwear
  class ErrorReportsController < ApplicationController
    skip_before_filter :authenticate_user!

    helper Softwear::Engine.helpers do
      def method_missing(name, *args, &block)
        if main_app.respond_to?(name)   
          main_app.send(name, *args, &block)
        else                   
          super                
        end                    
      end
    end

    def email_report
      if current_user
        user = current_user
      else
        begin
          user = User.find(params[:user_id]) unless params[:user_id].blank?
        rescue StandardError => _e
        end
      end

      ErrorReportMailer.send_report(user, params).deliver
      flash[:success] = 'Sent error report. Sorry about that and thank you for your submission.'

      if user
        redirect_to '/'
      elsif params[:order_id] && (key = Order.where(id: params[:order_id]).pluck(:customer_key).first)
        redirect_to customer_order_path(key)
      else
        render inline: "<%= flash[:success] %>"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
softwear-lib-2.0.1 app/controllers/softwear/error_reports_controller.rb
softwear-lib-2.0.0 app/controllers/softwear/error_reports_controller.rb
softwear-2.0.7 app/controllers/softwear/error_reports_controller.rb
softwear-2.0.6 app/controllers/softwear/error_reports_controller.rb
softwear-2.0.5 app/controllers/softwear/error_reports_controller.rb
softwear-2.0.4 app/controllers/softwear/error_reports_controller.rb
softwear-2.0.3 app/controllers/softwear/error_reports_controller.rb