tricknotes / ember-cli-rails

Unify your EmberCLI and Rails Workflows
http://thoughtbot.github.io/ember-cli-rails/
MIT License
713 stars 205 forks source link

mount_ember_app to: matches other routes that start with the to-path #529

Open jakeonfire opened 7 years ago

jakeonfire commented 7 years ago

We mount the ember app to: /dashboard and also have routes like /dashboards/billing, and when the mount_ember_app router line comes before the dashboards routes, it catches all of them and shows the ember index page. E.g. navigating to localhost:3001/dashboards/billing displays the ember app as if the route were localhost:3001/dashboard. If resources :dashboards comes first it appears to work, but when mount_ember_app is first, it seems to do a substring match and catches e.g. /dashboardanythingafter/is/ignored.

Is it possible to only match routes that end with the mount path optionally followed by /?#? Or does that miss some cases?

Which operating system and version is the project developed on? OS X Yosemite

Which version of ruby is the project developed on? 4.2.1

Which version of npm is the project developed on? Yarn 0.24.4

Which version of ember-cli is the project developed on? 2.11.0

What is the rails version? 5.0.2

What is the ember-cli-rails version (from Gemfile)? 0.8.3

What is the ember-cli-rails-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 - multi-threaded

What are the contents of config/initializers/ember.rb?

EmberCli.configure do |c|
  c.app :dashboard, yarn: true
end

What are the contents of the Rails' view that renders the Ember application? gem default

How are the EmberCLI-related routes defined?

mount_ember_app :dashboard, to: '/dashboard'

How is the application deployed? Capistrano

nruth commented 7 years ago

It sounds like you've already found the usual rails routing solution to this: define the other route first?

The thing I'd watch for here is people already inside the ember app not being able to visit those pages in the rails app because of ember thinking they're part of the ember app. If you're using # locations rather than urls inside of ember that might not be an issue, but I've never used them so not sure about that.