lib/with_model/base.rb in with_model-0.1.1 vs lib/with_model/base.rb in with_model-0.1.2
- old
+ new
@@ -1,27 +1,32 @@
-require 'mixico'
+begin
+ require 'mixico'
+rescue LoadError
+end
module WithModel
class Base < ActiveRecord::Base
class << self
def with_model?
true
end
- def include(*args)
- @modules_to_unmix ||= []
- args.each do |mod|
- unless @modules_to_unmix.include?(mod)
- @modules_to_unmix << mod
+ if defined?(Mixico)
+ def include(*args)
+ @modules_to_unmix ||= []
+ args.each do |mod|
+ unless @modules_to_unmix.include?(mod)
+ @modules_to_unmix << mod
+ end
end
+ super
end
- super
- end
- def _with_model_deconstructor
- @modules_to_unmix.each do |mod|
- disable_mixin mod
- end if defined?(@modules_to_unmix)
+ def _with_model_deconstructor
+ @modules_to_unmix.each do |mod|
+ disable_mixin mod
+ end if defined?(@modules_to_unmix)
+ end
end
end
end
end