All Questions

484
votes
5answers
141978 views

How should a model be structured in MVC?

I am just getting a grasp on the MVC framework and I often wonder how much code should go in the model. I tend to have a data access class that has methods like this: public function CheckUsername($c...
256
votes
14answers
84999 views

Doctrine2: Best way to handle many-to-many with extra columns in reference table

I'm wondering what's the best, the cleanest and the most simply way to work with many-to-many relations in Doctrine2. Let's assume that we've got an album like Master of Puppets by Metallica with se...
16
votes
3answers
5207 views

getting the values from a nested complex object that is passed to a partial view

I have a ViewModel that has a complex object as one of its members. The complex object has 4 properties (all strings). I'm trying to create a re-usable partial view where I can pass in the complex o...
4
votes
1answers
1233 views

How to create a generic object model for use in QML?

I would like to know if there is any macro or way how to register Qt model as property of QObject. For example, I have AnimalModel (http://doc.qt.io/qt-5/qtquick-modelviewsdata-cppmodels.html#qabstra...
169
votes
27answers
72106 views

Is there a way to get a collection of all the Models in your Rails app?

Is there a way that you can get a collection of all of the Models in your Rails app? Basically, can I do the likes of: - Models.each do |model| puts model.class.name end
170
votes
2answers
155185 views

Django set default form values

I have a Model as follows. class TankJournal(models.Model): user = models.ForeignKey(User) tank = models.ForeignKey(TankProfile) ts = models.IntegerField(max_length=15) title = models.CharFie...
27
votes
2answers
37063 views

Real example of TryUpdateModel, ASP .NET MVC 3

I can't understand, how to use TryUpdateModel and save the MVC architecture at the same time. If I am not mistaken, work with datacontexts must be in the Model. So, such code var db=new TestEverybod...
73
votes
2answers
11313 views

Fat models, skinny controllers and the MVC design pattern

I just read a blog post that explains MVC with a banking analogy. I have a few months of experience with web application development with an MVC framework (CakePHP), so I get the basics, but I began t...
43
votes
8answers
29982 views

All Levels of a Factor in a Model Matrix in R

I have a data.frame consisting of numeric and factor variables as seen below. testFrame <- data.frame(First=sample(1:10, 20, replace=T), Second=sample(1:20, 20, replace=T), Third=sample...
89
votes
5answers
149567 views

Accessing MVC's model property from Javascript

I have the following model which is wrapped in my view model public class FloorPlanSettingsModel { public int Id { get; set; } public int? MainFloorPlanId { get; set; } public string Imag...

Previous Next