Class: Gluttonberg::Admin::Membership::GroupsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- BaseController
- Gluttonberg::Admin::Membership::GroupsController
- Defined in:
- app/controllers/gluttonberg/admin/membership/groups_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #delete ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
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 |
#delete ⇒ Object
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 |
#destroy ⇒ Object
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 |
#edit ⇒ Object
30 31 |
# File 'app/controllers/gluttonberg/admin/membership/groups_controller.rb', line 30 def edit end |
#index ⇒ Object
12 13 14 |
# File 'app/controllers/gluttonberg/admin/membership/groups_controller.rb', line 12 def index @groups = Group.all end |
#new ⇒ Object
16 17 18 |
# File 'app/controllers/gluttonberg/admin/membership/groups_controller.rb', line 16 def new @group = Group.new end |
#update ⇒ Object
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 |