Created
May 20, 2013 14:17
-
-
Save joefiorini/5612528 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // How you could do what you want in Ember | |
| App.Router.map(function(){ | |
| this.resource("userSession", function(){ | |
| this.route("new", { path: "/sign-in" }); | |
| }) | |
| }); | |
| // However, any time you create a resource you have an extra layer of routing | |
| // & a model that you may/may not want. In the case of sign-in, which doesn't | |
| // really represent part of the UI, I'd consider just using a route instead. | |
| App.Router.map(function(){ | |
| this.route("signIn", { path: "/sign-in" }); | |
| }); | |
| // Then in your controller you can set the current session on ApplicationController | |
| App.SignInController = Ember.Controller.extend({ | |
| signIn: function(){ | |
| var session = UserSession.validate(this.get("username"), this.get("password")); // assuming you have some object with a session token or something | |
| this.controllers("application").set("session", sesssion); | |
| } | |
| }); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also, not sure if you saw this but this looks like an interesting approach:
http://say26.com/using-rails-devise-with-ember-js