From 8270e4a8ce8337fca98030953922e5992b06a3dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baza=CC=81n?= Date: Mon, 30 Jan 2012 21:36:47 +0100 Subject: Added `none` query method to return zero records. And added NullRelation class implementing the null object pattern for the `Relation` class. --- activerecord/lib/active_record/null_relation.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 activerecord/lib/active_record/null_relation.rb (limited to 'activerecord/lib/active_record/null_relation.rb') diff --git a/activerecord/lib/active_record/null_relation.rb b/activerecord/lib/active_record/null_relation.rb new file mode 100644 index 0000000000..60c37ac2b7 --- /dev/null +++ b/activerecord/lib/active_record/null_relation.rb @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- + +module ActiveRecord + # = Active Record Null Relation + class NullRelation < Relation + def exec_queries + @records = [] + end + end +end \ No newline at end of file -- cgit v1.2.3