mount_ember_app with custom path - No route matches [GET] "/assets/frontend.js"
Closed this issue · 1 comments
Which operating system and version is the project developed on?
Mac OS X 10.11.6 (15G1108)
Which version of [ruby
][ruby] is the project developed on?
2.2.3p173
Which version of [npm
][npm] is the project developed on?
4.0.2
Which version of [ember-cli
][ember-cli] is the project developed on?
ember-cli: 2.9.1
node: 4.4.4
os: darwin x64
What is the [rails
][rails] version?
5.0.0.1
What is the [ember-cli-rails
][gem] version (from Gemfile
)?
0.8.3
What is the [ember-cli-rails-addon
][addon] version (from package.json
)?
0.8.0
Is your application server [multi-threaded][] (such as puma
and unicorn
) or is
it multi-process (such as thin and webrick)?
puma (3.6.2)
What are the contents of config/initializers/ember.rb
?
EmberCli.configure do |c|
c.app :frontend
end
What are the contents of the Rails' view that renders the Ember application?
I am just rendering the default index from EmberCli::EmberController
:
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Frontend</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/assets/vendor.css">
<link rel="stylesheet" href="/assets/frontend.css">
<meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="msN73mx+hlq9gXKywClNUIAe1xk1vkVxPYBlIqTsZIyti9MLAHojI/WtDi8FmPWpPxLJi87vK1O/MsgC5U2BYA==" />
</head>
<body>
<script src="/assets/vendor.js"></script>
<script src="/assets/frontend.js"></script>
</body>
</html>
How are the EmberCLI-related routes defined?
config/routes.rb
:
Rails.application.routes.draw do
root to: 'marketing#index'
devise_for :users
ActiveAdmin.routes(self)
mount_ember_app :frontend, to: "/app"
end
How is the application deployed?
Developing locally
I'm trying to get up and running with ember-cli-rails
, but I'm running into a problem whenever I set a custom path in mount_ember_app
in my routes.rb
. Everything works fine when it is mounted at /
. However, we want to use /
for a landing page, and then show the ember app to authenticated users at /app
.
When I visit /app
, the HTML loads correctly, but my Rails server displays a whole bunch of No route matches ...
errors:
ActionController::RoutingError (No route matches [GET] "/assets/vendor.css")
ActionController::RoutingError (No route matches [GET] "/assets/frontend.css")
ActionController::RoutingError (No route matches [GET] "/assets/frontend.js")
ActionController::RoutingError (No route matches [GET] "/assets/vendor.js")
However, the assets show up if I visit paths such as /app/assets/frontend.js
and /app/assets/frontend.css
in my browser.
Is this the expected behaviour? Do I need to customize the index view and change these paths manually?
Thanks!
Ah I see, I need to also set the rootURL
in frontend/config/environment.js
. That's mentioned later on in the README, but I think it would be helpful to mention that in the Mount
section under Routing options
. I will submit a pull request.