Class: UserGroupMembershipsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_navable, #current_navable=, #current_user, #point_navigation_to, #redirect_www_subdomain, #set_locale

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
# File 'app/controllers/user_group_memberships_controller.rb', line 16

def create
  if membership_params[:user_title].present?
    @user_id = User.find_by_title(membership_params[:user_title]).id
    @user_group_membership = UserGroupMembership.create(membership_params.merge({user_id: @user_id}))
  else
    head :no_content
  end
end

#destroyObject



41
42
43
44
45
46
# File 'app/controllers/user_group_memberships_controller.rb', line 41

def destroy
  if @user_group_membership
    @user_group_membership.destroy
    head :no_content
  end
end

#indexObject



8
9
10
11
12
13
14
# File 'app/controllers/user_group_memberships_controller.rb', line 8

def index
  authorize! :manage, @user
  
  @user = User.find(params[:user_id])
  @memberships = UserGroupMembership.now_and_in_the_past.find_all_by_user(@user)
  @navable = @user
end

#showObject



25
26
27
# File 'app/controllers/user_group_memberships_controller.rb', line 25

def show
  # update  # 2013-02-03 SF: This seems wrong, does it not?
end

#updateObject



29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/user_group_memberships_controller.rb', line 29

def update
  if @user_group_membership.update_attributes!( membership_params )
    respond_to do |format|
      format.json do
        #head :ok
        #respond_with_bip @user_group_membership
        respond_with @user_group_membership
      end
    end
  end
end