Skip to content

Instantly share code, notes, and snippets.

@elandesign
Created November 8, 2011 09:11
Show Gist options
  • Save elandesign/1347339 to your computer and use it in GitHub Desktop.
Save elandesign/1347339 to your computer and use it in GitHub Desktop.
Monkey patches to make CanCan work with Squeel
# 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