app/controllers/admin/permissions_controller.rb in radiant-reader-extension-3.0.0.rc3 vs app/controllers/admin/permissions_controller.rb in radiant-reader-extension-3.0.0.rc4

- old
+ new

@@ -7,11 +7,12 @@ end 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) + scope = @group.permissions.for(@page) + @permission = scope.first || scope.create! respond_to do |format| format.html { flash[:notice] = "#{@page.name} bound to group #{@group.name}" redirect_to admin_group_url(@group) } @@ -19,10 +20,10 @@ end end def destroy @permission = @group.permissions.find(params[:id]) - @page = @permission.page + @page = @permission.permitted @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)