Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX beta] Ensure container can still be provided to .create. #12731

Merged
merged 1 commit into from
Dec 19, 2015

Commits on Dec 19, 2015

  1. [BUGFIX beta] Ensure container can still be provided to .create.

    In Ember versions until 2.3.0 it was common to provide a `container`
    property (if needed) when creating instances of a factory manually. This
    might look like:
    
    ```
    let Foo = container.lookupFactory('model:foo');
    let instance = Foo.create({
      container
    });
    ```
    
    Many addons did this (examples include ember-cp-validations and ember-data).
    
    Our initial implementation of the deprecated `container` property on extendable
    factories used `Object.defineProperty` to ensure calling
    `instance.container` returned the correct value. Unfortunately, we only
    defined a getter which means calling `Foo.create({ container });`
    triggers the following error:
    
    ```
    Cannot set property container of [object Object] which has only a getter
    ```
    
    This change adds a setter (with an appropriate deprecation) to prevent
    triggering an error.
    rwjblue committed Dec 19, 2015
    Configuration menu
    Copy the full SHA
    258fc30 View commit details
    Browse the repository at this point in the history