I find it confusing that there is an ActiveRecord delete as well as destroy.
In my Controller I want to delete a user in my delete action.
The result would be that this instance represented by the User model no longer exists in the database.
Which method should I use for this?
...
I am currently working on a project where I create a Data Service based on an Entity Data Model. In my Entity Model I have several inherited entities (Such as Orders (Base), Prescriptions (Inherited)). From my data services I am having a problem through the data service where I can't reference the inherited type (prescriptions) only th...
There are a lot of examples on how to use the built-in Model-binding capabilities to automatically get a List of items. But they all refer to the Beta-releases of ASP.net MVC. It is also mentioned that there has been a change in this Model Binding but so far I was not able to find a good source on how it now works in the Final Release. A...
Suppose the following DB migration in Ruby:
create_table :question_votes do |t|
t.integer :user_id
t.integer :question_id
t.integer :vote
t.timestamps
end
Suppose further that I wish the rows in the DB contain unique (user_id, question_id) pairs. What is the right dust to put in the model to accompli...
In views i`m passing model strongly typed way like this:
System.Web.Mvc.ViewPage<HomeModel>
And then just use it:
<%= Model.Greeting %>
How it would be possible to use strongly typed model in layout?
Without strongly typing i would probably add necessary data at controller factory, then use it through (LayoutModel)Viewdata["La...
This is something I've been stuck on for a while now, and I have to apologize in advance for going into so much detail for such a simple problem. I just want to make it clear what I'm trying to do here.
Scenario
So, there's a model Foo, each Foo can either be red, green, or blue. Having URLs like /reds to list all red objects, and /red...
Are there any best practices that cover the places that ASP.NET MVC models should be defined?
A new ASP.NET MVC project has a nice neat Models folder for them to go in, but in a production environment they can come from other places:
Third party class libraries
WCF services
Is it acceptable for a strongly-typed view to use a class d...
I have a model by the name Filter but due to the changes in reorganizing the filters from 2.0.3, it is conflicting with the
ActionController::Filters::Filter (class)
In my filters_controller.rb when I try to find the filter
Filter.find(:id)
as rails is infering the ActionController::Filters::Filter class rather than my model clas...
I know maybe the answer to the question is obvious. But if anybody can give me a definitive answer, that would be helpful.
The question is : whether the java NIO package can provide some memory consistency assurance?
The scenario is :
Thread A Thread B
[modify Object X] ...
I am looking for some guidance on how to incorporate business rules into an asp.net mvc application and how they relate to the model.
First a little background so we know what kind of solutions are relative for this question. At work we use WinForms, MVP, BusinessObjects, DataAccessObjects, and DataTransferObjects. The boundaries of...
I work with many different models and simulations. Some of the older models and simulations are written in FORTRAN. Some of those models have been converted to C++, but the current trend is to create these models using MATLAB/SIMULINK. From a computer science perspective I have always felt MATLAB/SIMULINK was not a good solution. Wha...
After reading the Key-Value Coding Programming Guide, the Key-Value Observing Programming Guide and the Model Object Implementation Guide, as well as reading many StackOverflow entries on the topic and experimenting with various modelling scenarios, I feel like I have a good grasp on how to model my data.
I end up using declared propert...
Which models of algorithm running time exist?
We all expect mergesort to be faster than bublesort, and note that mergesort makes O(n log n) comparisons vs. O(n2) for bubblesort.
For other algorithms, you count other operations (than compares and swaps), such as pointer dereference, array lookup, arithmetic on fixed-size integers, etc.
...
Hi, everyone!
I am a noob in using model/view paradigm in Qt and have the following problem: I have a tree-like structure, that must be visualized via Qt. I found out, that QAbstractTableModel is perfect for my needs, so I write the following:
class columnViewModel : public QAbstractTableModel {
// some stuff...
};
Everything now ...
I was wondering if it was possible to create a view in a database then be able to link a Model to it?
...
I have a model with:
has_and_belongs_to_many :users
How do I validate that the model has at least one user in the model? I tried:
validates_presence_of :users
But that doesn't seem to give me what I want...
...
How can I call the log() function inside the model beforeSave() function?
All three variants I used didn't work:
function beforeSave() {
#...
Debugger::log($y.' '.$ty);
log('test');
$this->log('testmodel');
}
...
I know this question has been posted multiple times but I still couldn't find a definite answer to this problem. So, here I go:
class Invoice(models.Model):
program = models.ForeignKey(Program)
customer = models.ForeignKey(Customer, related_name='invoices')
participants = models.ManyToManyField(Participant, related_name='par...
Hi - I am new to Domain Modelling so forgive me for asking a couple of elementary questions. My first question is about knowing when to model domain relationships. I find sometimes I feel like all classes appear to be related in some way to most others and I am unclear about when I should model these relationships directly (by holding a ...
I'm a newbie to RoR - I have three models: Customer, Job and Note. Customers have Jobs, and both Customers and Jobs can have Notes. Is there a special way to handle this type of relationship in Rails, or will it work if I just have a normal belongs_to relationship with Note?
The issue that concerns me is the note having fields for ...