Class: Teams::LookupsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/jobshop/teams/lookups_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/jobshop/teams/lookups_controller.rb', line 11

def create
  email_addresses = params[:user][:email].split(",").map(&:strip).take(5)

  @lookup = Jobshop::User
    .where(email: email_addresses)
    .joins(:team)
    .select("jobshop_users.id AS id",
            "email",
            "jobshop_teams.name AS team_name")
    .group_by(&:email)

  @lookup.each_pair do |email, teams|
    Jobshop::TeamsMailer.found_teams(email, teams).deliver_later
  end

  redirect_to new_user_session_path
end

#showObject



7
8
9
# File 'app/controllers/jobshop/teams/lookups_controller.rb', line 7

def show
  @lookup = Jobshop::User.new
end