Skip to content

Instantly share code, notes, and snippets.

@thoughtbot
Created August 4, 2009 22:28
Show Gist options
  • Save thoughtbot/162332 to your computer and use it in GitHub Desktop.
Save thoughtbot/162332 to your computer and use it in GitHub Desktop.
class Admin::ArticlesController < ApplicationController
def show
if draft_and_admin?
@article = Article.find(params[:id])
render
else
deny_access
end
end
protected
def draft_and_admin?
Article.find(params[:id]).draft? && current_user.admin?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment