Class: Gluttonberg::Admin::Membership::GroupsController

Inherits:
BaseController show all
Defined in:
app/controllers/gluttonberg/admin/membership/groups_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



20
21
22
23
24
25
26
27
28
# File 'app/controllers/gluttonberg/admin/membership/groups_controller.rb', line 20

def create
  @group = Group.new(params[:gluttonberg_group])
  if @group.save
    flash[:notice] = "Group created!"
    redirect_to :action => :index
  else
    render :action => :new
  end
end

#deleteObject



43
44
45
46
47
48
49
# File 'app/controllers/gluttonberg/admin/membership/groups_controller.rb', line 43

def delete
  display_delete_confirmation(
    :title      => "Delete “#{@group.name}” group?",
    :url        => admin_membership_group_path(@group),
    :return_url => admin_membership_groups_path  
  )        
end

#destroyObject



51
52
53
54
55
56
57
58
59
# File 'app/controllers/gluttonberg/admin/membership/groups_controller.rb', line 51

def destroy
  if @group.destroy
    flash[:notice] = "Group deleted!"
    redirect_to :action => :index
  else
    flash[:error] = "There was an error deleting the group."
    redirect_to :action => :index
  end  
end

#editObject



30
31
# File 'app/controllers/gluttonberg/admin/membership/groups_controller.rb', line 30

def edit          
end

#indexObject



12
13
14
# File 'app/controllers/gluttonberg/admin/membership/groups_controller.rb', line 12

def index
  @groups = Group.all
end

#newObject



16
17
18
# File 'app/controllers/gluttonberg/admin/membership/groups_controller.rb', line 16

def new
  @group = Group.new
end

#updateObject



33
34
35
36
37
38
39
40
41
# File 'app/controllers/gluttonberg/admin/membership/groups_controller.rb', line 33

def update
  if @group.update_attributes(params[:gluttonberg_group])
    flash[:notice] = "Member account updated!"
    redirect_to  :action => :index
  else
    flash[:notice] = "Failed to save account changes!"
    render :action => :edit
  end 
end