Repository navigation
Add base model - #159
Add base model#159pangratz wants to merge 2 commits into
Conversation
|
|
||
| # Motivation | ||
|
|
||
| Currently if the models of your app have common functionality, a commong `attr` |
|
I haven't followed #143 too closely (🔔 shame 🔔) , but this RFC might need to be updated once that one is accepted... |
|
Notes:
Concerns:
|
|
As somebody who refactored the logic we use for "base" serializers and adapters recently, I'd rather not carry forward any more of this kind of default magic. I agree with @nathanhammond that the amount to learn, performance, and bundling issues make this feature seem like a lot of maintenance burden to avoid a little boilerplate. If we look at other ORM implementations like Rails's ActiveRecord, Django, Sails, Kinex, etc., none of them seem to use this pattern and I haven't seen it become very popular in userland for the reasons listed above either. Maybe some alternatives: For the |
@pangratz what do you think about instead making it easier to create an app-specific model blueprint? This gives users the opportunity to codify this kind of app convention (our models extend from our own base class) without committing ember-cli to making apps with a preemptive app-specific base class. |
|
@nathanhammond @fivetanley thanks for the great feedback. Adding another magical component might not be the best solution; I haven't thought of that... @hjdivad I like the idea of solving this on the blueprint level! We could extend the existing model blueprint by a I am not sure how an app-specific model blueprint would be implemented, because at the moment it contains template variables which would be something the user would need to consider when the app-specific blueprint would be adapted... |
|
I really would like people to get into the habit of creating an in-repo-addon for their custom blueprints. If people knew this tool were available to them I think it'd solve this whole problem. |
|
@nathanhammond keeping them in an in-repo addon sounds like a good convention. I still think there's some value to being able to override base bluerprints for a couple of reasons
@pangratz seems reasonable to me that
Good point. Maybe we would create an I realize that copying the base blueprint and editing it creates upgrade work, but i suspect people would find that reasonable when they're overriding base blueprints. |
|
@hjdivad Blueprints are overrideable and the in-repo-addon can either add a new blueprint type or clobber the default blueprint type as long as it specifies that it comes after ember-data and ember-cli-legacy-blueprints. An exceptionally clever person would even be able to As to (Note: things that seem reasonable to the people currently chatting on this thread aren't necessarily reasonable for everybody else. Maybe the real feature here is making |
|
In line with |
|
@runspired |
Rendered