Class: InvitesController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

current

Methods included from PathHelper

#finance_group_transactions_path

Instance Method Details

#authenticate_membership_or_admin_for_invitesObject (protected)



29
30
31
32
33
34
35
# File 'app/controllers/invites_controller.rb', line 29

def authenticate_membership_or_admin_for_invites
  authenticate_membership_or_admin(begin
    params[:invite][:group_id]
  rescue StandardError
    params[:id]
  end)
end

#createObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/invites_controller.rb', line 9

def create
  authenticate_membership_or_admin params[:invite][:group_id]
  @invite = Invite.new(params[:invite])
  if @invite.save
    Mailer.invite(@invite).deliver_now

    respond_to do |format|
      format.html do
        redirect_to root_path, notice: I18n.t('invites.success')
      end
      format.js { render layout: false }
    end

  else
    render action: :new
  end
end

#newObject



5
6
7
# File 'app/controllers/invites_controller.rb', line 5

def new
  @invite = Invite.new(user: @current_user, group: @group)
end