Module: Chili::EngineExtensions

Defined in:
lib/chili/engine_extensions.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/chili/engine_extensions.rb', line 3

def self.extended(base)
  base.rake_tasks do
    next if self.is_a?(Rails::Application)
    next unless has_migrations?

    namespace railtie_name do
      namespace :db do
        desc "Copy and migrate migrations from #{railtie_name}"
        task :migrate do
          Rake::Task["#{railtie_name}:install:migrations"].invoke
          Rake::Task["db:migrate"].invoke
        end
      end
    end
  end
end

Instance Method Details

#automount!(path = nil) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/chili/engine_extensions.rb', line 20

def automount!(path = nil)
  engine = self
  path ||= 'chili/' + engine.parent.to_s.underscore
  Rails.application.routes.draw do
    mount engine => path
  end
end