Class: Socializer::MembershipsController

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

Instance Method Summary collapse

Instance Method Details

#approveObject



18
19
20
21
# File 'app/controllers/socializer/memberships_controller.rb', line 18

def approve
  @membership.approve!
  redirect_to @membership.group
end

#confirmObject



30
31
32
33
# File 'app/controllers/socializer/memberships_controller.rb', line 30

def confirm
  @membership.confirm!
  redirect_to @membership.group
end

#createObject



5
6
7
8
9
# File 'app/controllers/socializer/memberships_controller.rb', line 5

def create
  @group = Group.find(params[:membership][:group_id])
  @group.join(current_user)
  redirect_to @group
end

#declineObject



35
36
37
38
# File 'app/controllers/socializer/memberships_controller.rb', line 35

def decline
  @membership.decline!
  redirect_to groups_pending_invites_path
end

#destroyObject



11
12
13
14
15
16
# File 'app/controllers/socializer/memberships_controller.rb', line 11

def destroy
  @membership = current_user.memberships.find(params[:id])
  @group = @membership.group
  @group.leave(current_user)
  redirect_to @group
end

#inviteObject



23
24
25
26
27
28
# File 'app/controllers/socializer/memberships_controller.rb', line 23

def invite
  invited_user = Person.find(params[:user_id])
  group = Group.find(params[:group_id])
  group.invite(invited_user)
  redirect_to group
end