dgeb/ember_data_example — pull request #17 by jjjohnson (2012-09-25 12:35:11+00:00)
Title: Added basic rails user auth with no ember enforcement

Preface:
@dgeb I know that you don't want to include user auth in your example app, but my sole mission in creating this pull request is to show a primitive example of user auth using ember and rails, which I couldn't really find online.

Overview:
After attempting numerous possible solutions to enforce user access to ember routes/states, I couldn't find much fruitful guidance aside from http://stackoverflow.com/questions/12272881/best-way-to-enforce-user-authentication-state-in-ember-js-app which, at the time of this writing, proved inconclusive.

I then resorted to Rails Controllers, adding current_user user_id's to the creation of new Contact records, while feeding scoped AMS data to the ember app through current_user.id.

This swiss-cheese solution provides a primitive foundation on which to build, but leaves large auth holes when a user tries to access contacts that they did not create (which are then added to their rendered list of contacts).

I also realize that the ember app can be rendered in the middle of the page with use of append_to and proper rendering of the application template, and that app views should only be rendered when content or data is present, but it's too damn late to include those tonight. Hopefully someone else will chime in, or I'll have time tomorrow to improve on this debacle.

Anyway, I want to thank you once again for your awesome ember demo app, and although this wont be a direct contribution to it, I hope to contribute to the ember community in the near future. I thank you once again, and from CA, I bid you G'night good sir.