Commit 2860c701 by Prem Sichanugrist

Require Paperclip::Schema only when used with AR

This will solve an issue when using Paperclip without Active Record
such as Mongoid.

Fixes #919
parent f30f9cb7
...@@ -8,15 +8,9 @@ module Paperclip ...@@ -8,15 +8,9 @@ module Paperclip
base.extend ClassMethods base.extend ClassMethods
base.send :include, Callbacks base.send :include, Callbacks
base.send :include, Validators base.send :include, Validators
base.send :include, Schema base.send :include, Schema if defined? ActiveRecord
base.class_attribute :attachment_definitions base.class_attribute :attachment_definitions
if defined?(ActiveRecord)
ActiveRecord::ConnectionAdapters::AbstractAdapter.send(:include, Paperclip::Schema)
ActiveRecord::ConnectionAdapters::Table.send(:include, Paperclip::Schema)
ActiveRecord::ConnectionAdapters::TableDefinition.send(:include, Paperclip::Schema)
end
locale_path = Dir.glob(File.dirname(__FILE__) + "/locales/*.{rb,yml}") locale_path = Dir.glob(File.dirname(__FILE__) + "/locales/*.{rb,yml}")
I18n.load_path += locale_path unless I18n.load_path.include?(locale_path) I18n.load_path += locale_path unless I18n.load_path.include?(locale_path)
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment