Sha256: 63e250ff7157438de5e2fc96c6716dfbbcda957fabf1b52c3e8a59dd5e4b03dc

Contents?: true

Size: 940 Bytes

Versions: 2

Compression:

Stored size: 940 Bytes

Contents

require 'refinerycms-core'
require 'globalize'

module Refinery
  autoload :PageImagesGenerator, 'generators/refinery/page_images_generator'

  module PageImages

    class << self
      def root
        @root ||= Pathname.new(File.expand_path('../../../', __FILE__))
      end

      def factory_paths
        @factory_paths ||= [ root.join('spec', 'factories').to_s ]
      end

      def attach!
        require 'refinery/page'
        require 'refinery/page_images/extension'

        config.enabled_models.each do |model_class_name|
          unless (model_class = model_class_name.safe_constantize)
            Rails.logger.warn "PageImages is unable to find model class: #{model_class_name}"
            next
          end
          model_class.send :has_many_page_images
        end

        Refinery::Image.send :has_many, :image_pages, :dependent => :destroy
      end
    end

    require 'refinery/page_images/engine'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
refinerycms-page-images-3.0.0 lib/refinery/page_images.rb
refinerycms-page-images-4.0.0 lib/refinery/page_images.rb