Skip to content

Instantly share code, notes, and snippets.

@workmad3
Created May 25, 2011 14:07
Show Gist options
  • Save workmad3/991045 to your computer and use it in GitHub Desktop.
Save workmad3/991045 to your computer and use it in GitHub Desktop.
class InlineFormsController < ApplicationController
def self.cancan_enabled?
return @cancan_enabled if instance_variables.include?(:@cancan_enabled)
::Ability
@cancan_enabled = true
rescue NameError
@cancan_enabled = false
end
def cancan_enabled?
self.class.cancan_enabled?
end
helper :cancan_enabled?
load_and_authorize_resource if cancan_enabled?
include InlineFormsHelper
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment