Class: UserQueriesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/user_queries_controller.rb

Overview

rubocop:todo Style/Documentation

Constant Summary

Constants included from FlashTruncation

FlashTruncation::STRING_OVERHEAD

Instance Method Summary collapse

Methods inherited from ApplicationController

#block_api_access, #evil_parameter_hack!, #extract_header_info, #set_cache_disabled!

Methods included from FlashTruncation

#max_flash_size, #truncate_flash, #truncate_flash_array

Instance Method Details

#createObject

rubocop:todo Metrics/AbcSize


7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/user_queries_controller.rb', line 7

def create # rubocop:todo Metrics/AbcSize
  @user_query = UserQuery.new(user_query_params.merge(user: current_user))
  if @user_query.valid?
    UserQueryMailer.request_for_help(@user_query).deliver_now
    flash[:notice] = "Thank you for your request. We will contact you shortly (via #{@user_query.user_email})"
    redirect_to new_user_query_path
  else
    flash.now[:error] = @user_query.errors.full_messages
    render :new
  end
end

#newObject


3
4
5
# File 'app/controllers/user_queries_controller.rb', line 3

def new
  @user_query = UserQuery.new(url: request.referer, user: current_user)
end

#user_query_paramsObject


19
20
21
# File 'app/controllers/user_queries_controller.rb', line 19

def user_query_params
  params.require(:user_query).permit(:user_email, :url, :what_was_trying_to_do, :what_happened, :what_expected)
end