Search code examples
javascriptruby-on-railsember.jsember-router

Start ember in a specific route


Im trying integrate emberjs on ruby on rails,

https://github.com/emberjs/ember-rails

rails generate ember:install --head

Ok now emberjs is working, but now how can I for example make emberjs work only on a specific route.

I can do it in rails:

root to: static/index

Now I want make ember start and work only on posts, cause at the moment when I install the gem only works on application.


Solution

  • I had the opposite a few days back, wanted to serve one page outside of ember.

    I created a new namespace in my router.rb and a new layout file in my views/layout/ (api.html.erb), which serves as a base for all my non-ember pages. To a big extend it was a copy of my application.html.erb.

    You can then specify in the appropriate controllers that they need to make use of the other layout file.

    class Api::ShareController < ApplicationController
      layout 'api'
    
      def index
      end
    end