1
votes

I have this huge model called Permit with a whole bunch of attributes like Fees, Setbacks, Building Dimensions, etc. Each of those attributes also has smaller attributes that describe it (represented as normal attributes).

Example. Fees is made up of a couple other random specific fees that are all added together to receive the total fees (represented as 'Fees')

I want to get to the point where a User can set their own attributes (or models?) about whatever they would like pertaining to the Permits.

Am I going in the right direction but making all of these attributes to the 'Permit' model?

EDIT: Also if Fees, Setbacks, etc. deserve their own model, how would I show another model's template.hbs on that permit.hbs? I come from a Rails background and Ember routes confuses the hell out of me.

EDIT2: I have no intention of making Fees, Setbacks, etc. have it's own page.

1

1 Answers

1
votes

To show another model's template, use {{render}}. For example, {{render 'fees'}} will render fees using a singleton instance of FeesController. Note that render can only be used once without specifying a model. To show a set of fees accessible from the controller of the current view, you would do: {{render 'fees' my.list.of.fees}} where my.list.of.fees is any property path that would make sense in the context of the current controller.

As far as how to model on the Ember side, this is a judgement call to make depending on how you are working with the data. In my current app I have both collapsed server side models into attributes, and used client-side models that are constructed server-side at serialization time from combinations of attributes of other server-side models that I don't need to fully model client-side. You can also use the client-side serialization to re-compose the json you are getting. So you can model each side to suit your needs, and use the server-side and/or client-side serialization to map.