lib/dusen/syntax.rb in dusen-0.4.8 vs lib/dusen/syntax.rb in dusen-0.4.9
- old
+ new
@@ -36,10 +36,16 @@
end
private
DEFAULT_UNKNOWN_SCOPER = lambda do |scope, *args|
- scope.where('1=2')
+ if scope.respond_to?(:where)
+ # Rails 3
+ scope.where('1=2')
+ else
+ # Rails 2
+ scope.scoped(:conditions => ['1=2'])
+ end
end
def unknown_scoper
@unknown_scoper || DEFAULT_UNKNOWN_SCOPER
end