Module HasManyPolymorphs
In: lib/has_many_polymorphs/autoload.rb
lib/has_many_polymorphs/railtie.rb

Methods

setup  

Classes and Modules

Class HasManyPolymorphs::Railtie

Constants

MODELS_ROOT = Rails.root.join('app', 'models')   Searches for models that use has_many_polymorphs or acts_as_double_polymorphic_join and makes sure that they get loaded during app initialization. This ensures that helper methods are injected into the target classes.

Note that you can override DEFAULT_OPTIONS via Rails::Configuration#has_many_polymorphs_options. For example, if you need an application extension to be required before has_many_polymorphs loads your models, add an after_initialize block in config/environment.rb that appends to the ‘requirements‘ key:

  Rails::Initializer.run do |config|
    # your other configuration here

    config.after_initialize do
      config.has_many_polymorphs.options['requirements'] << 'lib/my_extension'
    end
  end
DEFAULT_OPTIONS = { :file_pattern => "#{MODELS_ROOT}/**/*.rb", :file_exclusions => ['svn', 'CVS', 'bzr'], :methods => ['has_many_polymorphs', 'acts_as_double_polymorphic_join'], :requirements => []}

Public Class methods

Dispatcher callback to load polymorphic relationships from the top down.

[Validate]