Class: InvitesController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

current

Instance Method Details

#authenticate_membership_or_admin_for_invitesObject (protected)


30
31
32
# File 'app/controllers/invites_controller.rb', line 30

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

#createObject


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

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


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

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