Class: Paperclip::S3::Railtie

Inherits:
Rails::Railtie
  • Object
show all
Defined in:
lib/paperclip-s3/railtie.rb,
lib/paperclip-s3/railtie.rb

Class Method Summary collapse

Class Method Details

.insertObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/paperclip-s3/railtie.rb', line 15

def self.insert
  in_production = false
  s3_environments = ENV['S3_ENVIRONMENTS'] ? ENV['S3_ENVIRONMENTS'].split(',') : ['production']
  if (defined?(Rails.env) && Rails.env)
    in_production = s3_environments.include?(Rails.env)
  elsif (defined?(RAILS_ENV) && RAILS_ENV)
    in_production = s3_environments.grep(RAILS_ENV)
  end

  ActiveRecord::Base.send(:include, Paperclip::S3::Glue) if in_production
end