Open rmcsharry opened 8 years ago
@rmcsharry thanks for opening this issue -- could you please read the CONTRIBUTING document and update the format of your issue to populate the issue template?
Could you share the pertinent portion of your config/routes.rb
file?
EmberCli routes requests to the Ember application by declaring a catch-all route, constrained to format: :html
requests.
How are you mounting your Ember application?
Where are you mounting it? Is it before the notes#edit
route declaration?
If you're declaring notes#edit
after the call to mount_ember_application
, try declaring mount_ember_application
as far down in your routes file as possible.
@seanpdoyle You are correct, I was mounting the ember app too early in the routes file.
Solved by "declaring mount_ember_application as far down in your routes file as possible."
Thanks!
@seanpdoyle I think there is something basic I am missing here about how ember-cli-rails affects routing. Perhaps you can shed some light?
After I moved the mount_ember route root "/" to below my rails routes, rspec worked fine...but the ember routes no longer work...?
This breaks rspec, ember routes work, rails json routes work:
Rails.application.routes.draw do
mount_ember_app :trekclient, to: "/"
resources :employees
resources :addresses
resources :trails
resources :notes
resources :comments
resources :assignments
end
This fixes rspec, none of the ember routes work:
Rails.application.routes.draw do
resources :employees
resources :addresses
resources :trails
resources :notes
resources :comments
resources :assignments
mount_ember_app :trekclient, to: "/"
end
I think there is something basic I am missing here about how ember-cli-rails affects routing. Perhaps you can shed some light?
@rmcsharry in your application's case, mount_ember_app
effectively mounts the Ember application to /(*rest)
, with a format: :html
constraint.
but the ember routes no longer work...?
Could you elaborate a bit more on the issues you're having when your mount_ember_app
is at the bottom of your routes file?
Which operating system and version is the project developed on? OSX El Capitan
Which version of [
ruby
][ruby] is the project developed on? 2.3.1Which version of [
npm
][npm] is the project developed on? 3.10.6Which version of [
ember-cli
][ember-cli] is the project developed on? 2.7What is the [
rails
][rails] version? 5.0.0.1What is the [
ember-cli-rails
][gem] version (fromGemfile
)? 0.8.0What is the [
ember-cli-rails-addon
][addon] version (frompackage.json
)? 0.8.0Is your application server [multi-threaded][](such as
puma
andunicorn
) or is it multi-process (such as thin and webrick)? pumaWhat are the contents of
config/initializers/ember.rb
?What are the contents of the Rails' view that renders the Ember application? It's empty
How are the EmberCLI-related routes defined?
How is the application deployed? It's not, this is locally in development
I am not sure if this is an issue, but if I just want (for now) to write api tests only such as model and controller and route tests, I get the impression that ember-cli-rails is in the way?
Example output when running 'rspec spec'
NotesController routing routes to #edit Failure/Error: expect(:get => "/notes/1/edit").to route_to("notes#edit", :id => "1")
I am a bit confused about how I can fix that?