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

Trouble with dynamic segments #525

Closed allthesignals closed 7 years ago

allthesignals commented 7 years ago

Hello, issue template follows below. I'm struggling with getting routes with dynamic segments to work. Either it cannot find the required assets OR I see the error described in https://github.com/thoughtbot/ember-cli-rails/issues/95. Is there an example of a dynamic segment I should use?

Which operating system and version is the project developed on? OS 10 Sierra Which version of ruby is the project developed on? 2.3.3 Which version of npm is the project developed on? 4.1.2 Which version of ember-cli is the project developed on? ~2.13.0-beta.3 What is the rails version? 5.0.1 What is the ember-cli-rails version (from Gemfile)? 0.8.4 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)?

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

EmberCli.configure do |c|
  c.app :surveymap
end

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

<%= render_ember_app :surveymap do |head, body| %>
  <% head.append do %>
    <%= stylesheet_link_tag "application" %>
    <%= csrf_meta_tags %>
  <% end %>
  <div class="ui inverted vertical center aligned segment">
    <%= render partial: 'layouts/menu' %>
  </div>
<% end %>

How are the EmberCLI-related routes defined?

Router.map(function() {
  this.route('/', { path: '*' });
});
...
rootURL: '/surveys/:id',
  mount_ember_app :surveymap, to: 'surveys/:id',
    controller: 'surveys',
    action: 'show',
    as: :show_survey
seanpdoyle commented 7 years ago

Have you tried omitting the dynamic segment from the Rails route?

  mount_ember_app :surveymap, to: 'surveys/',
    controller: 'surveys',
    action: 'show',
    as: :show_survey
allthesignals commented 7 years ago

@seanpdoyle that seemed to do the trick! I'm not sure why, though - each time, Ember would throw 'does not start with the provided rootURL' error (I needed to update rootURL as well in this latest attempt). Does the trailing / denote there's a child route?

Thank you for maintaining this project and taking care of all the questions! Very much appreciated. Happy to close this now.