Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd74267364 | ||
|
|
f8631dcc93 |
@@ -1,3 +1,8 @@
|
|||||||
|
1.3.1 (August 6, 2010)
|
||||||
|
|
||||||
|
* Fixing protected sanitize_sql error - see issue #111
|
||||||
|
|
||||||
|
|
||||||
1.3.0 (August 6, 2010)
|
1.3.0 (August 6, 2010)
|
||||||
|
|
||||||
* Adding :find_by option to load_resource - see issue #19
|
* Adding :find_by option to load_resource - see issue #19
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = "cancan"
|
s.name = "cancan"
|
||||||
s.version = "1.3.0"
|
s.version = "1.3.1"
|
||||||
s.author = "Ryan Bates"
|
s.author = "Ryan Bates"
|
||||||
s.email = "ryan@railscasts.com"
|
s.email = "ryan@railscasts.com"
|
||||||
s.homepage = "http://github.com/ryanb/cancan"
|
s.homepage = "http://github.com/ryanb/cancan"
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ module CanCan
|
|||||||
end
|
end
|
||||||
|
|
||||||
def sanitize_sql(conditions)
|
def sanitize_sql(conditions)
|
||||||
@sanitizer.sanitize_sql(conditions)
|
@sanitizer.send(:sanitize_sql, conditions)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Takes two hashes and does a deep merge.
|
# Takes two hashes and does a deep merge.
|
||||||
|
|||||||
@@ -19,9 +19,12 @@ class Ability
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# this class helps out in testing nesting and SQL conditions
|
# this class helps out in testing SQL conditions
|
||||||
class Person
|
class Person
|
||||||
def self.sanitize_sql(hash_cond)
|
class << self
|
||||||
|
protected
|
||||||
|
|
||||||
|
def sanitize_sql(hash_cond)
|
||||||
case hash_cond
|
case hash_cond
|
||||||
when Hash
|
when Hash
|
||||||
sanitize_hash(hash_cond).join(' AND ')
|
sanitize_hash(hash_cond).join(' AND ')
|
||||||
@@ -31,7 +34,7 @@ class Person
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.sanitize_hash(hash)
|
def sanitize_hash(hash)
|
||||||
hash.map do |name, value|
|
hash.map do |name, value|
|
||||||
if Hash === value
|
if Hash === value
|
||||||
sanitize_hash(value).map{|cond| "#{name}.#{cond}"}
|
sanitize_hash(value).map{|cond| "#{name}.#{cond}"}
|
||||||
@@ -41,3 +44,4 @@ class Person
|
|||||||
end.flatten
|
end.flatten
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user