Permalink
Browse files

Avoid a NoMethodError exception when running ActiveRecord edge test c…

…ases
  • Loading branch information...
1 parent 36fbf3f commit 500ca27d6ff4b9b6335bf337f80214e73bacec55 @samleb committed Dec 13, 2012
Showing with 8 additions and 3 deletions.
  1. +8 −3 lib/sexy_scopes/active_record.rb
@@ -46,12 +46,17 @@ def sql_literal(expression)
# @!visibility private
def respond_to?(method_name, include_private = false) # :nodoc:
- super || column_names.include?(method_name.to_s)
+ super || respond_to_missing?(method_name, include_private)
end
- # @!visibility private
+ # # @!visibility private
def respond_to_missing?(method_name, include_private = false) # :nodoc:
- column_names.include?(method_name.to_s)
+ super || column_names.include?(method_name.to_s)
+ rescue NoMethodError
+ # For some unknown reason, edge ActiveRecord tests raises the following
+ # when trying to Marshal.dump a record:
+ # "NoMethodError: undefined method `abstract_class?' for Object:Class"
+ false
end
private

0 comments on commit 500ca27

Please sign in to comment.