Class: Detour::GroupsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Detour::GroupsController
- Defined in:
- app/controllers/detour/groups_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/detour/groups_controller.rb', line 10 def create @group = Detour::Group.new(params[:group]) if @group.save flash[:notice] = "Your group has been successfully created." render "detour/shared/success" else @model = @group render "detour/shared/error" end end |
#destroy ⇒ Object
33 34 35 36 37 38 |
# File 'app/controllers/detour/groups_controller.rb', line 33 def destroy @group = Detour::Group.find(params[:id]) @group.destroy flash[:notice] = "Group \"#{@group.name}\" has been deleted." redirect_to groups_path end |
#index ⇒ Object
2 3 4 |
# File 'app/controllers/detour/groups_controller.rb', line 2 def index @groups = Detour::Group.all end |
#show ⇒ Object
6 7 8 |
# File 'app/controllers/detour/groups_controller.rb', line 6 def show @group = Detour::Group.find(params[:id]) end |
#update ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/detour/groups_controller.rb', line 22 def update @group = Detour::Group.find(params[:id]) if @group.update_attributes(params[:group]) flash[:notice] = "Your group has been successfully updated." redirect_to group_path @group else render :show end end |