Skip to content

Instantly share code, notes, and snippets.

@samuelkadolph
Forked from workmad3/gist:991045
Created May 25, 2011 14:23
Show Gist options
  • Save samuelkadolph/991066 to your computer and use it in GitHub Desktop.
Save samuelkadolph/991066 to your computer and use it in GitHub Desktop.
class InlineFormsController < ApplicationController
def self.cancan_enabled?
return @cancan_enabled if defined?(@cancan_enabled)
@cancan_enabled = begin
::Ability && true
rescue NameError
false
end
end
def cancan_enabled?
self.class.cancan_enabled?
end
helper_method :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