Sha256: 6070a510b4aa41d55464445b6184da53341a326189ac05b169cc9357cce5dda1
Contents?: true
Size: 1.35 KB
Versions: 3
Compression:
Stored size: 1.35 KB
Contents
module Softwear class ErrorReportsController < ApplicationController skip_before_action :authenticate_user! rescue nil before_action :assign_current_user, only: :email_report controller = self helper Softwear::Engine.helpers do define_method :current_user do controller.instance_variable_get(:@current_user) end 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_now 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) rescue false) redirect_to customer_order_path(key) else render inline: "<%= flash[:success] %>" end end private def assign_current_user @current_user = current_user rescue nil end end end
Version data entries
3 entries across 3 versions & 1 rubygems