Commit b9d9fc44 by Jon Yurek

Automatic initialization for Rails 2 and Rails 3

parent aa93daec
......@@ -37,6 +37,7 @@ require 'paperclip/interpolations'
require 'paperclip/style'
require 'paperclip/attachment'
require 'paperclip/callback_compatability'
require 'paperclip/railtie'
if defined?(Rails.root) && Rails.root
Dir.glob(File.join(File.expand_path(Rails.root), "lib", "paperclip_processors", "*.rb")).each do |processor|
require processor
......@@ -47,7 +48,7 @@ end
# documentation for Paperclip::ClassMethods for more useful information.
module Paperclip
VERSION = "2.3.2"
VERSION = "2.3.2.beta1"
class << self
# Provides configurability to Paperclip. There are a number of options available, such as:
......@@ -71,8 +72,6 @@ module Paperclip
end
def configure
ActiveRecord::Base.send(:include, Paperclip)
File.send(:include, Paperclip::Upfile)
yield(self) if block_given?
end
......
require 'paperclip'
module Paperclip
if defined? Rails::Railtie
require 'rails'
class Railtie < Rails::Railtie
config.after_initialize do
Paperclip::Railtie.insert
end
end
end
class Railtie
def self.insert
ActiveRecord::Base.send(:include, Paperclip)
File.send(:include, Paperclip::Upfile)
end
end
end
$LOAD_PATH << File.join(File.dirname(__FILE__), 'lib')
require 'paperclip'
include_files = ["README*", "LICENSE", "Rakefile", "init.rb", "{generators,lib,tasks,test,shoulda_macros}/**/*"].map do |glob|
include_files = ["README*", "LICENSE", "Rakefile", "init.rb", "{lib,tasks,test,rails,generators,shoulda_macros}/**/*"].map do |glob|
Dir[glob]
end.flatten
exclude_files = ["test/s3.yml", "test/debug.log", "test/paperclip.db", "test/doc", "test/doc/*", "test/pkg", "test/pkg/*", "test/tmp", "test/tmp/*"].map do |glob|
......
require 'paperclip/railtie'
Paperclip::Railtie.insert
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