7
가 나는 마운트 레일 엔진이레일이 장착 엔진의 JS
gem 'my_engine', :path => 'engines/my_engine'
로 Gemfile
에 포함 나는
alert('hello');
이 app/engines/my_engine/app/assets/javascripts/my_engine/application.js
에서
Rails.application.routes.draw do
mount MyEngine::Engine => "/blog", as: 'blog_engine'
end
로 주요 애플 리케이션에 장착이로드되지 app/engines/my_engine/lib/my_engine/engine.rb
에 나는
module MyEngine
class Engine < ::Rails::Engine
isolate_namespace MyEngine
# Append engine's migrations to root app's migrations
initializer :append_migrations do |app|
unless app.root.to_s.match root.to_s
config.paths["db/migrate"].expanded.each do |expanded_path|
app.config.paths["db/migrate"] << expanded_path
end
end
end
config.autoload_paths += Dir["#{config.root}/spec/support"]
initializer "my_engine.precompile" do |app|
app.config.assets.paths << Rails.root.join('/engines/my_engine/app/assets/javascripts')
app.config.assets.precompile << "my_engine/application.js"
end
end
end
그러나 내가 다시로드 할 때 http://localhost:3000/blog
경고 메시지가 나타나지 않습니까? 내가 뭘 놓치고 있니?
엔진에 맞는 것 같습니다. 경고 전화를하는 방법을 게시 할 수 있습니까? 문제가 경보 호출 중일 수 있습니다. 엔진을 설정하고 Gemfile에 추가 한 후'''bundle install'''을 실행했다고 가정합니다. –
Allam Matsubara 예, 맞습니다. gemfile에 엔진을 지정하고 번들 설치를 실행했습니다. –
경고 호출이 있습니까? –