Top "Model" questions

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

How to set a default attribute value for a Laravel / Eloquent model?

If I try declaring a property, like this: public $quantity = 9; ...it doesn't work, because it is not considered an "attribute", …

php model laravel laravel-4 eloquent
How I can put composite keys in models in Laravel 5?

I have in my DataBase a table with two primary keys (id and language_id) and I need put it …

php laravel model composite-primary-key
Raise a validation error in a model's save method in Django

I'm not sure how to properly raise a validation error in a model's save method and send back a clear …

django validation model validationerror
Call a model method in a Controller

I'm have some difficulties here, I am unable to successfully call a method which belongs to a ProjectPage model in …

ruby-on-rails methods model controller instantiation
Ruby on Rails: errors.add_to_base vs. errors.add

I have read that errors.add_to_base should be used for errors associated with the object and not a …

ruby-on-rails ruby validation model
Rails: Update model attribute without invoking callbacks

I have a User model that has a :credits attribute. I want a simple button that will add 5 to the …

ruby-on-rails ruby model attributes callback
How to rename rails controller and model in a project

I started a Rails app and everything works fine. But now, I would like to rename a controller and the …

ruby-on-rails model controller rename
Rails has_many with dynamic conditions

What I want is to create a Model that connects with another using a has_many association in a dynamic …

ruby-on-rails model
Incompatible Data Reader Exception From EF Mapped Objects

I am using Entity Framework and have updated a table and its stored procedure but I'm getting the following error …

asp.net-mvc entity-framework model mapping
Django Queryset with filtering on reverse foreign key

I have the following Django model: class Make: name = models.CharField(max_length=200) class MakeContent: make = models.ForeignKey(Make) published = …

django model filter django-queryset