Permalink
Browse files

fixed Queris.included? logic; was broken when ActiveRecord was not pr…

…esent
  • Loading branch information...
1 parent 14eaaef commit 60bcf3911fc54627be9aef922e29839492c0cb6f @slact committed Mar 2, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/queris.rb
View
@@ -92,11 +92,12 @@ def self.use_query_redis(*args)
end
def self.included(base)
+ return if base.include? Queris #include only once
base.send :include, ObjectMixin
- if ActiveRecord and base.superclass == ActiveRecord::Base then
+ if const_defined?('ActiveRecord') and base.superclass == ActiveRecord::Base then
require "queris/mixin/active_record"
base.send :include, ActiveRecordMixin
- elsif Ohm and base.superclass == Ohm::Model
+ elsif const_defined?('Ohm') and base.superclass == Ohm::Model
require "queris/mixin/ohm"
base.send :include, OhmMixin
end

0 comments on commit 60bcf39

Please sign in to comment.