I am new to ember and I am developing an app in ember 1.13 with a back end in Rails. I understand that the session and data store handling has changed from previous versions of ember quite a bit. I am using ember-simple-auth
In particular, I am trying to recuperate data from an authenticated user and cannot get it. Documentation in the web uses both SessionService
and Ember.Service
but the difference is not clear to me. Can somebody help either with an explanation or with a link?
Asked
Active
Viewed 281 times
0

user2953607
- 97
- 1
- 2
- 8
1 Answers
0
In ember you can create services
same way you can create routes
and controllers
, it is class/paradigm that you use to build your application. You can create your own service by subclassing Ember.Service
, if you have logic that needs to be shared across the app then it is good candidate for being a service
.
If you are using ember-cli
you can generate service with ember g service <service-name>
And SessionService
is service that manages session provided/created by ember-simple-auth
.

Bek
- 3,157
- 1
- 17
- 28
-
So, at the same level as `services` one can also create `sessions` (`app/sessions`). Are these sessions independent of the `SessionService`? I imagine that is the case. And if so, can you use both in parallel? – user2953607 Jan 08 '16 at 17:53
-
1i think if they match names one will overwrite other, but you can always create service with different name `x-session` for example, but since `ember-simple-auth` provides full session management there is no need creating another service I think – Bek Jan 08 '16 at 17:58
-
Indeed, with the same name, the session is overwritten. So where is the correct place to define `currentUser` data (retrieved using authenticated details) and attach it to the `SessionService`? Is this a servicei `app/services`? – user2953607 Jan 08 '16 at 18:40
-
I think you need to override the session provided by `ember-simple-auth` have look at their docs they should have such use case covered in docs – Bek Jan 08 '16 at 18:45