aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_relation/extensions
diff options
context:
space:
mode:
authorNick Kallen <nkallen@nick-kallens-computer-2.local>2008-03-16 20:47:02 -0700
committerNick Kallen <nkallen@nick-kallens-computer-2.local>2008-03-16 20:47:02 -0700
commit89b354bf97d0a981376d36f2f8a7ba6a87fe2aa8 (patch)
tree2e7fe3a9a814bc0ffacc48c50e0bc4d5de18bb0d /lib/active_relation/extensions
parent9771b2f3a3fdb45517a132228a1129718acd2fac (diff)
downloadrails-89b354bf97d0a981376d36f2f8a7ba6a87fe2aa8.tar.gz
rails-89b354bf97d0a981376d36f2f8a7ba6a87fe2aa8.tar.bz2
rails-89b354bf97d0a981376d36f2f8a7ba6a87fe2aa8.zip
added attribute.eq(nil)
- produces attribute IS NULL
Diffstat (limited to 'lib/active_relation/extensions')
-rw-r--r--lib/active_relation/extensions/array.rb2
-rw-r--r--lib/active_relation/extensions/nil_class.rb5
-rw-r--r--lib/active_relation/extensions/object.rb4
-rw-r--r--lib/active_relation/extensions/range.rb2
4 files changed, 11 insertions, 2 deletions
diff --git a/lib/active_relation/extensions/array.rb b/lib/active_relation/extensions/array.rb
index 2af5832707..793c06aad8 100644
--- a/lib/active_relation/extensions/array.rb
+++ b/lib/active_relation/extensions/array.rb
@@ -7,7 +7,7 @@ class Array
"(" + collect { |e| e.to_sql(formatter) }.join(', ') + ")"
end
- def predicate_sql
+ def inclusion_predicate_sql
"IN"
end
end \ No newline at end of file
diff --git a/lib/active_relation/extensions/nil_class.rb b/lib/active_relation/extensions/nil_class.rb
new file mode 100644
index 0000000000..729c4cada7
--- /dev/null
+++ b/lib/active_relation/extensions/nil_class.rb
@@ -0,0 +1,5 @@
+class NilClass
+ def equality_predicate_sql
+ 'IS'
+ end
+end \ No newline at end of file
diff --git a/lib/active_relation/extensions/object.rb b/lib/active_relation/extensions/object.rb
index cd51543c91..25cef989a4 100644
--- a/lib/active_relation/extensions/object.rb
+++ b/lib/active_relation/extensions/object.rb
@@ -7,6 +7,10 @@ class Object
formatter.scalar self
end
+ def equality_predicate_sql
+ '='
+ end
+
def metaclass
class << self
self
diff --git a/lib/active_relation/extensions/range.rb b/lib/active_relation/extensions/range.rb
index 0218a0ab44..d7329efe34 100644
--- a/lib/active_relation/extensions/range.rb
+++ b/lib/active_relation/extensions/range.rb
@@ -3,7 +3,7 @@ class Range
formatter.range self.begin, self.end
end
- def predicate_sql
+ def inclusion_predicate_sql
"BETWEEN"
end
end \ No newline at end of file