Giter Site home page Giter Site logo

cybertooth-io / ember-data-base-model Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 4.14 MB

A Base Ember-Data model including `createdAt` and `updatedAt` attributes matching those found in Ruby on Rails timestamped resources.

Home Page: https://cybertooth-io.github.io/ember-data-base-model/

License: MIT License

JavaScript 87.87% HTML 12.02% CSS 0.11%
ember-data base-model active-record-timestamp active-record

ember-data-base-model's Introduction

ember-data-base-model

Implementation of a Base model that leverages Rails Active Record timestamp fields. Additional helper functions are provided to query model status/persistence.

CircleCI

Maintainability Test Coverage

ember-lts-2.16 ember-lts-2.18

ember-lts-3.4 ember-lts-3.8

Compatibility

  • Ember.js v3.4 or above
  • Ember CLI v2.13 or above

Docs

View the docs here.

Dependencies

I maintain a list of the dependencies that I've mixed into this addon project.

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

Credits

This addon was made possible with the support of:

  1. Ember Data

ember-data-base-model's People

Contributors

dependabot-preview[bot] avatar ember-tomster avatar nadnoslen avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

ember-data-base-model's Issues

Code Climate Misreporting Coverage

For some reason Code Climate can't see this addon's the test results for either the base model or serializer? Weird. It's in the coverage.json.

{"total": {"lines":{"total":20,"covered":18,"skipped":0,"pct":90},"statements":{"total":20,"covered":18,"skipped":0,"pct":90},"functions":{"total":7,"covered":6,"skipped":0,"pct":85.71},"branches":{"total":3,"covered":3,"skipped":0,"pct":100}}
,"addon/models/-base.js": {"lines":{"total":19,"covered":17,"skipped":0,"pct":89.47},"functions":{"total":7,"covered":6,"skipped":0,"pct":85.71},"statements":{"total":19,"covered":17,"skipped":0,"pct":89.47},"branches":{"total":3,"covered":3,"skipped":0,"pct":100}}
,"addon/serializers/-base.js": {"lines":{"total":1,"covered":1,"skipped":0,"pct":100},"functions":{"total":0,"covered":0,"skipped":0,"pct":100},"statements":{"total":1,"covered":1,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"app/mirage-factories/user.js": {"lines":{"total":0,"covered":0,"skipped":0,"pct":0},"functions":{"total":0,"covered":0,"skipped":0,"pct":0},"statements":{"total":0,"covered":0,"skipped":0,"pct":0},"branches":{"total":0,"covered":0,"skipped":0,"pct":0}}
,"app/mirage-models/user.js": {"lines":{"total":0,"covered":0,"skipped":0,"pct":0},"functions":{"total":0,"covered":0,"skipped":0,"pct":0},"statements":{"total":0,"covered":0,"skipped":0,"pct":0},"branches":{"total":0,"covered":0,"skipped":0,"pct":0}}
,"app/models/-base.js": {"lines":{"total":0,"covered":0,"skipped":0,"pct":0},"functions":{"total":0,"covered":0,"skipped":0,"pct":0},"statements":{"total":0,"covered":0,"skipped":0,"pct":0},"branches":{"total":0,"covered":0,"skipped":0,"pct":0}}
,"app/serializers/-base.js": {"lines":{"total":0,"covered":0,"skipped":0,"pct":0},"functions":{"total":0,"covered":0,"skipped":0,"pct":0},"statements":{"total":0,"covered":0,"skipped":0,"pct":0},"branches":{"total":0,"covered":0,"skipped":0,"pct":0}}
}

`becomeDirty()` Seems To Be Throwing Some Errors In Ember-2.x

"Error: Assertion Failed: You modified "value" twice on <valet@component:-text-field::ember1671> in a single render. It was rendered in "component:-text-field" and modified in "component:-text-field". This was unreliable and slow in Ember 1.x and is no longer supported. See https://github.com/emberjs/ember.js/issues/13948 for more details.
    at new EmberError (http://localhost:3000/assets/vendor.js:35502:25)
    at Object.assert (http://localhost:3000/assets/vendor.js:35745:15)
    at Object.exports.assertNotRendered (http://localhost:3000/assets/vendor.js:45215:42)
    at propertyDidChange (http://localhost:3000/assets/vendor.js:45333:15)
    at set (http://localhost:3000/assets/vendor.js:47213:7)
    at Class._elementValueDidChange (http://localhost:3000/assets/vendor.js:68478:27)
    at Class.focusOut (http://localhost:3000/assets/vendor.js:68547:12)
    at Class.trigger (http://localhost:3000/assets/vendor.js:69542:23)
    at Class.superWrapper [as trigger] (http://localhost:3000/assets/vendor.js:67561:22)
    at Backburner.join (http://localhost:3000/assets/vendor.js:31479:31)"

I noticed this happening when we toggle a select boxes value for a model's relationship. Triggering the option choice from the select box also calls the model's becomeDirty() function. Once the model is saved, this error is presented in the console.

Fix CircleCI Builds

CircleCI is failing to build for a weird reason. Visit my issue over in ember-cli-addon-docs

Remove Deprecations For Ember-Data-4

The following deprecations were introduced because now that Ember supports accessors without using the .get(...) function, we can't pollute the names with question marks (like in Ruby). I got comfortable decorating my computed property names with question marks in 2014 and now it needs to stop.

  • ember-data-base-model/models/-base.deprecate-unaltered-question-mark
  • ember-data-base-model/models/-base.deprecate-altered-question-mark
  • ember-data-base-model/models/-base.deprecate-persisted-question-mark
  • ember-data-base-model/models/-base.deprecate-new-question-mark
  • ember-data-base-model/models/-base.deprecate-dirty-question-mark
  • ember-data-base-model/models/-base.deprecate-clean-question-mark

Dependabot couldn't parse the config file at .dependabot/config.yml

Dependabot couldn't parse the config file at .dependabot/config.yml. The error raised was:

(<unknown>): did not find expected '-' indicator while parsing a block collection at line 4 column 3

Please ensure the config file is a valid YAML file. On online YAML linter is available here.

You can mention @dependabot in the comments below to contact the Dependabot team.

Default createdAt & updatedAt To Now - Can Save Formatting Errors?

I use intl to format dates. If I CREATE a new model and my template discovers it before it is actually saved, it might use intl to try to format my createdAt and/or updatedAt values and puke when it discovers they are null. This can break page flow and rendering.

The FIX: set the createdAt and updatedAt to now.

  updatedAt: attr('date', {
    defaultValue: function () {
      return new Date();
    }
  }),

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.