Skip to content

Instantly share code, notes, and snippets.

@danielwestendorf
Created December 17, 2014 15:00
Show Gist options
  • Select an option

  • Save danielwestendorf/6d76624cf1cc5e00b70c to your computer and use it in GitHub Desktop.

Select an option

Save danielwestendorf/6d76624cf1cc5e00b70c to your computer and use it in GitHub Desktop.
# routes.rb
resources :documents
# app/controllers/documents_controller.rb
class DocumentsController < ApplicationController
authenticate :user
find_and_authorize :documents, :edit, through: :memberships, only: [:edit, :update]
find_and_authorize :documents, :delete, through: :memberships, only: :destroy
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment