From a33ffc7c6cacc5f3b2d5462535ed1b677f03fa73 Mon Sep 17 00:00:00 2001
From: Amos Benari <amos.benari@elastifile.com>
Date: Sun, 9 Nov 2014 15:03:15 +0200
Subject: [PATCH] Fixing failed test in rails 4.1, active record 4.1
UnknownAttributeError interface changed.
---
lib/scoped_search/definition.rb | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/scoped_search/definition.rb b/lib/scoped_search/definition.rb
index 99bc21f..ec0f4e6 100644
--- a/lib/scoped_search/definition.rb
+++ b/lib/scoped_search/definition.rb
@@ -84,7 +84,11 @@ def column
if klass.columns_hash.has_key?(field.to_s)
klass.columns_hash[field.to_s]
else
- raise ActiveRecord::UnknownAttributeError, "#{klass.inspect} doesn't have column #{field.inspect}."
+ if "#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}".to_f < 4.1
+ raise ActiveRecord::UnknownAttributeError, "#{klass.inspect} doesn't have column #{field.inspect}."
+ else
+ raise ActiveRecord::UnknownAttributeError.new( klass, field )
+ end
end
end
end