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

Ember can v2 #94

Merged
merged 25 commits into from Aug 12, 2019
Merged

Ember can v2 #94

merged 25 commits into from Aug 12, 2019

Conversation

Exelord
Copy link
Collaborator

@Exelord Exelord commented Dec 18, 2018

This PR will prepare for v2.0 release

Issue: #82 #89

New features

  1. If you pass undefined as a model to can or cannot it do not override a model defined in class definition.
  2. You can override property parser per each Ability class, overriding parseProperty() method to use eg. custom prefix like is (isReadable) instead of can (canReadable)
  3. You can now get a value for specific ability using CanService#valueFor, eg. this.can.valueFor('createProjects', 'account', model, properties)

Deprecations

  1. You will not longer be able to import CanMixin as it will be removed. You can reproduce its behavior using can service and its methods.
  2. import { CanService } from 'ember-can' -> import CanService from 'ember-can/services/can'
  3. import { ability } from 'ember-can' -> import { ability } from 'ember-can/computed'
  4. build method of can service will be replaced by abilityFor

Breaking changes

  1. You have to pass a null model if you want to pass only parameters to can or cannot methods of can service. Eg: this.get('canService').can('post', null, { test: true })
  2. The model passed to helpers or can service methods, as from now on, can be anything instead of an Ember.Object instance.
  3. can and cannot methods will always return a boolean
  4. Abilities are now an instance of the Ability class, so setting model or properties on it will not modify the class constructor anymore.
  5. Ability class name will be always singularized automatically, eg. edit posts -> edit post. All abilities files should be created with the SINGULAR form
  6. Drop support for Node 6
  7. Drop support for ember < 3.4

addon/services/can.js Outdated Show resolved Hide resolved
Copy link

@villander villander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Exelord Exelord merged commit 70d8126 into master Aug 12, 2019
@Exelord Exelord deleted the feature-2.0 branch August 12, 2019 16:16
@Exelord Exelord added the breaking Breaking Change label Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants