Closed martinwi closed 10 years ago
Hi Martin,
I don't know much about your application. Specifically, I don't know how the views want to use the data in the model and how data is sent to and from the server. Even so, it looks to me like your content
in this model is far too complex. My guess is that it would be better to break it up into individual properties.
For example, my guess is you should have a location model
maria.Model.subclass(trip, 'LocationModel', {
properties: {
_gps: '',
_eta: '',
_name: '',
// ...
Then in your trip.TripModel
, the start property would be an instance of a trip.LocationModel
.
Thanks Peter.
That makes sense.
My initial thoughts were to start with a generic (and simple) "note" model, which largely emulates the TodoModel, but I'm not sure how I'd roll those up into an Array of notes to be used by other objects in the model.
Can a maria.SetModel class contain other maria.SetModels, or am I trying to make this more complex than it needs to be?
Thanks Martin...
A maria.SetModel
instance can contain other maria.SetModel
instances. Events bubble up through the whole tree.
If you have more questions, feel free to ask.
I am desperately trying to get a more complex model working with Maria and wondered if you would be kind enough to point me in the right direction. It’s my first attempt at writing an MVC based application and I’m struggling to comprehend the best approach to start off with.
In an attempt to create an itinerary for a road trip, I have a model in mind, but can think of various approaches.
Should I be creating different models for each subcomponent/portion of my object model or dealing with it as one? Using your TodoModel.js structure, I’m attempting to shoehorn in my travel itinerary “trip” object:
I’d really appreciate your thoughts on the best approach for this, so I make best use of Maria, as it was intended.
Thanks Martin...