diff --git a/CHANGELOG.md b/CHANGELOG.md index a01c66dd..5304f0f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,10 @@ master ------ * Fix bug with generated `bin/heroku_install` script iterating through multiple - Ember application's directories. +* Don't mount route helpers at top-level. Instead, mount within the surrounding + context with which they're invoked. [#381] + +[#381]: https://github.com/thoughtbot/ember-cli-rails/pull/381 0.7.0 ----- diff --git a/lib/ember_cli/route_helpers.rb b/lib/ember_cli/route_helpers.rb index f20f8639..f21f7421 100644 --- a/lib/ember_cli/route_helpers.rb +++ b/lib/ember_cli/route_helpers.rb @@ -14,15 +14,13 @@ def mount_ember_app(app_name, to:, **options) format: :html, ) - Rails.application.routes.draw do - scope constraints: EmberCli::HtmlConstraint.new do - get("#{to}(*rest)", routing_options) - end + scope constraints: ::EmberCli::HtmlConstraint.new do + get("#{to}(*rest)", routing_options) + end - dist_directory = EmberCli[app_name].paths.dist + dist_directory = ::EmberCli[app_name].paths.dist - mount Rack::File.new(dist_directory.to_s) => to - end + mount Rack::File.new(dist_directory.to_s) => to end end end