Skip to content

Instantly share code, notes, and snippets.

@thoughtbot
Created August 4, 2009 22:28
Show Gist options
  • Save thoughtbot/162330 to your computer and use it in GitHub Desktop.
Save thoughtbot/162330 to your computer and use it in GitHub Desktop.
class Admin::ArticlesController < ApplicationController
before_filter :deny_access, :unless => :draft_and_admin?
def show
@article = Article.find(params[:id])
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