Object saved into Service lost an attribute value

I have a service current-shop.js which is defined s follows:


import Service from '@ember/service';

export default Service.extend({
  shop: null,

  setShop(shop) {
    this.set('shop', shop)

The main purpose of this service is to always keep traces of the current shop (that could be changed by selecting another one from a drop-down list).

I set its shop value ony in two cases:

  • in the very beginning when logging the user:
  • when a user selects another shop from the drop-down list:
# components/shop-list.js

export default Component.extend({
  i18n: service(),
  currentShop: service(),
  shops: [],
  tagName: '',
  aShop: null,
  notFoundMessage: t('components.shop.list.messages.not.found'),

  actions: {
    chooseShop(shop) {
      this.set('aShop', shop);

The shop-list.hbs component looks like that:

# templates/components/shop-list.hbs

<label for="shop_select">{{t 'components.shop.list.labels.change.shop'}}</label>

  onchange=(action "chooseShop")
  as |shop|

The problem I have is that I can display all the needed values coming from the current shop but the only one: modifiedBy.

I pass modified_by value from the backend to Ember. I have Shop model defined as follows in Ember:

# models/shop.js
export default DS.Model.extend({
  modifiedBy:    DS.attr('string'),
... //other attributes come here
  shopName: computed('identifier', 'name', function() {
    return `${this.get('identifier')}-${this.get('name')}`;

The question how is it possible to have one attribute (or property) of an objet attached to a service disappeared ? Is there any way to trace it ? Thank you.

I’m using active_model_serializers gem and I had to remove the following lines (advised by AMS docs) from Rails:

  • from initiallizer
# config/initializers/active_model_serializer.rb

ActiveModelSerializers.config.key_transform = :unaltered
  • from mime_types.rb:
# config/initializers/mime_types.rb

#Mime::Type.register "application/vnd.api+json", :json

Hope this helps

To start tracing the problem, use Ember Inspector, go to the Data tab and find your Shop model. You will be able to see there if it has a modifiedBy field and what the value is.