Reputation: 682
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.
Upvotes: 0
Views: 280
Reputation: 1587
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
Upvotes: 0
Reputation: 23322
I don't know your code, but this is might what you are searching for:
App.Router.map(function() {
this.resource('posts');
});
App.IndexRoute = Ember.Router.extend({
redirect: function() {
this.transitionTo('posts');
}
});
this will cause that navigating to the /
URL of your ember app will immediately transitions to the /posts
route.
for more information on redirecting in ember you can check out the docs
hope it helps
Upvotes: 1