I have a very complex interactive page as part of a Rails application I'm working on, and it's really an SPA
. I want to leverage Ember to do this so I have much more manageable code. All I really need Rails for is to ferry data back and forth on this page. Another reason for using Ember is so I don't have all of these nasty jQuery one-liner view templates written in JS (I prefer to use CoffeeScript).
I installed and configured Ember-CLI by following the instructions in the README for the ember-cli-rails
gem. I have created a separate layout for any sections of my application that I want to use Ember. I have a route for Products
set up to include the Ember JS and CSS resources. I can now see the "Welcome to Ember" message on the page for this route in my Rails application.
But I can't do anything else. I've tried to just create an "About" section for this little Ember application, which is called products
. The problems I see so far:
- The ember-cli-rails gem initializer does not create a
views
directory. Why is that? - I have yet to locate an
Ember-CLI
tutorial that doesn't have just a ton of assumptions built in.
I have an about.js.coffeee
in my <ember app>/routes
directory, one in <ember app>/controllers
directory, one in a <ember app>/views
directory that I had to create, and an emblem
template in <ember app>/templates
directory.
Now for a really basic question. How do I bring up this route in the browser? If I type in the route:
http://localhost:3000/products
I get my Ember page, as I should. But if I put:
http://localhost:3000/products/about
Then Rails tries to handle that route, of course. Which is not at all what I want. This is the step that is missing from the tutorials I have read. I would always recommend that a tutorial be put in front of a laymen in order to find the holes prior to publication. I would be happy to volunteer for that job in order to offer something to the community.
How do I navigate to an Ember route within my Rails application?