Created
November 8, 2011 09:11
-
-
Save elandesign/1347339 to your computer and use it in GitHub Desktop.
Monkey patches to make CanCan work with Squeel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Drop this into config/initializers to get CanCan working with Squeel | |
if defined?(Squeel) | |
module Squeel | |
module Nodes | |
class Predicate | |
alias_method :method, :method_name | |
alias_method :column, :expr | |
end | |
end | |
end | |
end | |
if defined?(CanCan) | |
module CanCan | |
module ModelAdapters | |
class ActiveRecordAdapter < AbstractAdapter | |
def self.override_condition_matching?(subject, name, value) | |
name.kind_of?(Squeel::Nodes::Predicate) if defined? Squeel | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment