- Routes dedicated to looking up a specific id'd model should use the
afterModel(resolvedModel, transition)
to perform any security checks concerning whether the current user is permitted to the given route. OBVIOUSLY the server-side API should prevent access, but if it doesn't this is a place to make that happen. An example of this kind of route isusers.user
where theapp/routes/users/user.js
is responsible for looking up a user with a specific id. If the requesteduser
model comes back from the server without a 401, you can further check the model with additional client-side logic to make sure that the current user is permitted to operate on it. - Events (e.g. clicks) should be handled by an action defined in the route. Use route-action helper. Why? Promotes component re-usability by it not being responsible for reacting to the event while the route serves a specific use case and can respond accordingly to the event.
- In order to unit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See http://help.github.com/ignore-files/ for more about ignoring files. | |
# compiled output | |
/dist | |
/tmp | |
# dependencies | |
/node_modules | |
/bower_components |
- When naming indexes in migrations, make sure to use names that do not contain any spaces.
There are times when using jsonapi-resources that you will need to write your own controller actions because you have complicated logic or a resource with relationships to process in a single transactioned request. It's nice to know how to handle the success and failure responses in a JSONAPI compliant manner. Thankfully jsonapi-resources exposes these features to us, you just need to read some code to figure out how to use them.
Consider a use-case where you are updating a Users
model and its collection of assigned Roles
. Say you author an action in your users_controller.rb
named update_user_and_roles
:
def update_user_and_roles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This configuration file is being used by my EmberJS addon that I recently upgraded to | |
# Ember-2.14 (the current release at time of writing) | |
machine: | |
node: | |
version: 6 # My project is using Node6 for now while Node8 works through some kinks | |
dependencies: | |
cache_directories: | |
- '~/.npm' | |
- '~/.cache' # includes bower & yarn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*jshint node:true*/ | |
/** | |
* I'd suggest removing any old testem.json files in the root of your | |
* Ember application. | |
* | |
* With this configuration, your tests will run in Chrome by default. | |
* | |
* To run your tests in headless (FASTER) mode (launch_in_ci): | |
* `ember t` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<templateSet group="Ember.js-2.16+ Imports"> | |
<template name="icomputed" value="import { $methods$ } from '@ember/object/computed';" description="Import the @ember/object/computed" toReformat="true" toShortenFQNames="true"> | |
<variable name="methods" expression="enum("alias", "and", "bool", "collect", "deprecatingAlias", "empty", "equal", "filter", "filterBy", "gt", "gte", "intersect", "lt", "lte", "map", "mapBy", "match", "max", "min", "none", "not", "notEmpty", "oneWay", "or", "readOnly", "reads", "setDiff", "sort", "sum", "union", "uniq", "uniqBy")" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="JAVA_SCRIPT" value="true" /> | |
</context> | |
</template> | |
<template |