Skip to content

Instantly share code, notes, and snippets.

@Sutto
Forked from technicalpickles/downloads_controller.rb
Created October 13, 2008 21:17
Show Gist options
  • Save Sutto/16606 to your computer and use it in GitHub Desktop.
Save Sutto/16606 to your computer and use it in GitHub Desktop.
class DownloadsController < ApplicationController
before_filter :can_create?, :only => [:new, :create]
before_filter :can_edit?, :only => [:edit, :update, :destroy]
resources_controller_for :downloads
helper_method :can_create?, :can_edit?
def can_create?
return !!(current_user && current_user.superuser?)
end
def can_edit?
return !!(current_user && current_user.superuser?)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment