Class: Admin::PermissionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::PermissionsController
- Defined in:
- app/controllers/admin/permissions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/admin/permissions_controller.rb', line 9 def create @page = Page.find(params[:page_id]) raise ActiveRecord::RecordNotFound unless @page @permission = Permission.find_or_create_by_page_id_and_group_id(@page.id, @group.id) respond_to do |format| format.html { flash[:notice] = "#{@page.name} bound to group #{@group.name}" redirect_to admin_group_url(@group) } format.js { render :partial => 'page' } end end |
#destroy ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/admin/permissions_controller.rb', line 22 def destroy @permission = @group..find(params[:id]) @page = @permission.page @permission.delete if @permission respond_to do |format| format.html { flash[:notice] = "#{@page.name} released from group #{@group.name}" redirect_to admin_group_url(@group) } format.js { render :partial => 'page' } end end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/admin/permissions_controller.rb', line 5 def index redirect_to admin_group_url(@group) end |