Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Do not add :without scope to classes with defined without method/scope

  • Loading branch information...
commit b73ddc4a7b465322d7a9e7640a1384ba8d145e0b 1 parent 98ab6fb
@ptzn ptzn authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/utility_scopes/without.rb
View
4 lib/utility_scopes/without.rb
@@ -11,7 +11,7 @@ def self.included(within)
# And automatically do so for all its subclasses
def self.inherited_with_without_scope_hook(child)
inherited_without_without_scope_hook(child)
- child.attach_without_utility_scope
+ child.attach_without_utility_scope unless child.respond_to?(:without)
end
class << self
alias_method_chain :inherited, :without_scope_hook
@@ -33,7 +33,7 @@ def attach_without_utility_scope
# after Article.without(@bad_article)
scope :without, lambda { |item_or_list|
# nil or empty array causes issues here with mysql
- item_or_list.blank? ? {} : {:conditions => ["#{quoted_table_name}.#{primary_key} NOT IN (?)", item_or_list]}
+ where("#{quoted_table_name}.#{primary_key} NOT IN (?)", item_or_list) unless item_or_list.blank?
}
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.