Sha256: 54a41896c4196d80a255ca82ed999592fa7a74286972a08d420af26f5936e5c9

Contents?: true

Size: 1.05 KB

Versions: 7

Compression:

Stored size: 1.05 KB

Contents

require "rails"
require "eitil_core"

module EitilCore

  class Railtie < Rails::Railtie

      initializer "my_railtie.configure_rails_initialization", options: :after do |app|

        # Dynamic dispatching after initialization of Rails classes.

        # ApplicationRecord
        
        if Object.const_defined?('EitilCore::ApplicationRecord::WhereLike')
          ::ApplicationRecord.send(:extend, EitilCore::ApplicationRecord::WhereLike)
        end

        if Object.const_defined?('EitilCore::ApplicationRecord::FindByLike')
          ::ApplicationRecord.send(:extend, EitilCore::ApplicationRecord::FindByLike)
        end

        if Object.const_defined?('EitilCore::ApplicationRecord::AllAssociations')
          ::ApplicationRecord.send(:extend, EitilCore::ApplicationRecord::AllAssociations)
        end

        # ApplicationController

        if Object.const_defined?('EitilCore::ApplicationController::SliceParams')
          ::ActionController::API.send(:include, EitilCore::ApplicationController::SliceParams)
        end        

      end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
eitil-1.0.4 eitil_core/lib/eitil_core/railtie.rb
eitil-1.0.3 eitil_core/lib/eitil_core/railtie.rb
eitil-1.0.3.e.1 eitil_core/lib/eitil_core/railtie.rb
eitil-1.0.2 eitil_core/lib/eitil_core/railtie.rb
eitil-1.0.1 eitil_core/lib/eitil_core/railtie.rb
eitil-1.0.1.e.4 eitil_core/lib/eitil_core/railtie.rb
eitil-1.0.1.e.3 eitil_core/lib/eitil_core/railtie.rb