Sha256: a4acb2519c98a39ae914387f149e4f3f1657db5523cfc7bf5ef55fc41ab4dc93

Contents?: true

Size: 852 Bytes

Versions: 2

Compression:

Stored size: 852 Bytes

Contents

module Heart
  class Engine < ::Rails::Engine
    isolate_namespace Heart
    
    # Run migrations from inside the rails engine
    # instead of copying to app with heart:install:migrations
    initializer :append_migrations do |app|
      # support migration files from metric fetch definition directories in root app lib/fetch
      app.config.paths['db/migrate'] << 'lib/heart'
      # also support migration files inside engine db/migrate directories
      unless app.root.to_s.match root.to_s
        if Rails.version.match /\A3\..*\z/
          app.config.paths["db/migrate"] += config.paths["db/migrate"].expanded
        elsif Rails.version.match /\A4\..*\z/
          config.paths["db/migrate"].expanded.each do |expanded_path|
            app.config.paths["db/migrate"] << expanded_path
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
heart-0.0.2 lib/heart/engine.rb
heart-0.0.1 lib/heart/engine.rb