Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

Where to put shared non-model logic?

$
0
0

@davegoulash wrote:

My app can be user configured to use different "rules". Models should use these rules to do calculations.

Something like:

rules  = Rules.create({config: {}});
rules.calculateWinner(instanceOfClassA);
rules.calculateStats(instanceOfClassB);

Where should I place the Rules class? Should it be a service?

I could move the calculateSomething() methods to the models and feed it the Rules instance as a param, but I don't want to create huge models.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles