Questions tagged [model]

Part of the MVC pattern, the Model manages the behaviour and data of the application.

The MVC (Model, View, Controller) pattern separates objects into one of three categories — models for maintaining data, views for displaying all or a portion of the data, and controllers for handling events that affect the model or view(s).

Frameworks such as Laravel, Rails, Django and ASP.NET MVC apply this pattern in the web development domain.

18996 questions
4
votes
4 answers

Rails association with tables without models

I'm looking to rewrite my project in Rails. It's currently written in PHP (CodeIgniter), I've come to the point where I'm writing more libraries and core extensions than I'm writing new code. I've been looking at some Rails tutorials and I'm liking…
Saff
  • 563
  • 1
  • 10
  • 21
4
votes
2 answers

Data annotations MVC3 Required attribute

I have the Model (User) below, I use it to add new users and to update existing users. When I'm adding a new user it's required to enter the user name and the password, and when I'm updating it's required to enter only the user name because it's…
Sah
  • 189
  • 1
  • 2
  • 11
4
votes
2 answers

Validate form input in Domain Objects setters?

Since I got into learning about MVC I have always validated my form data in my controllers which is a habit I picked up while skimming through CodeIgniters code but I have learned that its way of doing certain operations is not the best, it just…
ibanore
  • 1,500
  • 1
  • 12
  • 25
4
votes
3 answers

Use Entity Framework database first db context with mvvm view model classes

I am pretty new to MVVM and WPF and I am not completely sure if what I am going to ask now is correct. I am making a MVVM WPF application. I have a SQL Server database and I am using Entity Framework database-first to generate model classes for me.…
Phoenix
  • 913
  • 1
  • 8
  • 18
4
votes
2 answers

AssociationTypeMismatch (Object expected, got HashWithIndifferentAccess) in Rails app

I'm getting a AssociationTypeMismatch Error and I'm not sure where I'm making a mistake. I'm pretty new to Rails so I'm guessing I'm making some silly mistake. I've checked my syntax and compared it against AssociationTypeMismatch Error on Ruby on…
John Chan
  • 305
  • 2
  • 7
4
votes
1 answer

Dividing a mesh into tetrahedra?

Let's say I have some arbitrary set of points connected by faces and lines in order to make a closed polyhedron. Is there any algorithm that can divide such a mesh into a group of tetrahedra?
Conner Ruhl
  • 1,693
  • 4
  • 20
  • 31
4
votes
2 answers

How do I model UHF TV signal?

This may be a strange question, but I would like to programmatically model a UHF TV receiver. Anyone can give me some pointers? I have been looking at the code from emulators, but they are too specific for my purposes right now. To be more specific:…
Dervin Thunk
  • 19,515
  • 28
  • 127
  • 217
4
votes
2 answers

MVVM/Presentation Model With WinForms

I'm currently working on a brownfield application, it's written with winforms, as a preparation to use WPF in a later version, out team plans to at least use the MVVM/Presentation model, and bind it against winforms... I've explored the subject,…
Erik Ashepa
4
votes
3 answers

Problem creating ActiveRecord model: data missing from save

I'm having trouble creating a new model row in the database using ActiveRecord in a Sinatra app I'm developing. The object in question is being created without any errors (using save!, no exceptions are raised), but most of the data I specify for…
localshred
  • 2,244
  • 1
  • 21
  • 33
4
votes
3 answers

PHP: 5 layer model

I have question about how to "correctly" write my application. I would like to follow the service/DAO/mapper/entity model and I think that I fully understand it but I found out that some things which I want to do might collide with general…
grongor
  • 1,305
  • 1
  • 13
  • 26
4
votes
2 answers

How to load a text file in JavaScript?

I'm creating a simple WebGL project and need a way to load in models. I decided to use OBJ format so I need a way to load it in. The file is (going to be) stored on the server and my question is: how does one in JS load in a text file and scan it…
NPS
  • 6,003
  • 11
  • 53
  • 90
4
votes
1 answer

Making model binding work for a model with no default constructor

I’ve been trying to figure a way to have a model-binding go on with a model with a constructor with arguments. the action: [HttpPost] public ActionResult Create(Company company, HttpPostedFileBase logo) { …
Nikos
  • 7,295
  • 7
  • 52
  • 88
4
votes
1 answer

R - Model with a lot of dummy variables

If I have a column in a data set that has multiple variables how would I go about creating these dummy variables. Example: Lets say that I have a column named color it has: Red, Green, Yellow, Blue, Pink, and Grey as options for the color of a car.…
John
  • 129
  • 2
  • 2
  • 10
4
votes
2 answers

Qt Model/View Architecture - How to Handle More Complex Models

Is a model in Qt supposed to more or less fit the mold—and therefore ultimately be represented by—a list, table or tree? What if your model is a lot more complex and cannot be represented by a list, table or tree? If this were the case, I would…
nairware
  • 3,090
  • 9
  • 37
  • 58
4
votes
1 answer

How to add a new view controller in UIPageViewController after UIButton was tapped?

I was wondering how can I implement buttons which will affect the UIPageViewController's model. For example I would like my UIPageViewController model array to load with a single object in it and when a button is tapped a new view controller will be…
user1644365
  • 59
  • 1
  • 2
  • 8