Hi, I know about Association and Aggregation and Composition and Generalization what they are by definition. inheritance is "is a" relationship and composition is "has a" relationship.
Class A {
}
Class B extends A { // this is Generalization
}
Class C {
A ob; // this is composition
}
now my question is how the Aggregation and si...
To be more specific, "How do I validate that a model requires at least x valid associated models to be created?". I've been trying to validate nested models that get created in the same form as the parent (and ultimately show immediate validations a la jQuery). As a popular example, lets assume the following models and schema.
class Pro...
Let's say I have books which can be romance, fiction, or mystery. I have 2 realistic options to store this data. One is to have a type column in my books table that is a string with the value "romance", "fiction", or "mystery". The other is to create a book_types table and store the types in there. Then my books would have a type_id ...
If I inherit one DBML file from another DBML file, is it possible to visually create associations to the data classes from inherited DBML?
...
In CakePHP, I have two tables, Countries & Networks. They have a HABTM relationship and are joined by countries_networks.
I'm trying to get all countries from the countries table where the 'name' field in Networks = 'o2'
I've realised I can't do this using a basic find(), so I've been experimenting with the containable behaviour. I hav...
I am a ruby on rails newbie and had a question about the view logic in case of associated objects.
My models look similar to
class Post < ActiveRecord::Base
has_many :comments
end
class Comment < ActiveRecord::Base
belongs_to :post
end
And what I want to display is something like a list of all the posts and the 1st 3 comments f...
Hi
Can anyone help me with a clarification of these terms; Relation, Association, linkage..etc.
I have started a smaller study of UML with a particular focus on associations and their translation to source code.
I have noticed various terms are used when describing associations. Can one of you that have more knowledge about this ar...
Suppose I have 3 models, Car, Motorcycle and Truck, and for each I have to enter a bunch of stuff, such as a list of known previous owners, traffic tickets, license plates, etc. So I created a model for each (PreviousOwners, PreviousPlates, etc) and set up polymorphic associations for the related models.
The problem is, how can I enter ...
Hi folks,
I've got some tables in my Linq2Sql designer (in Visual Studio 2008). Works great.
Now, I just tried dropping in a View onto the designer. It dropped on there ok, but there's NO foreign keys/associations.
hmm. Ok, so then I tried to manually add an association between the View and a parent table. That worked .. but when i ...
Hi all!
This is my first post on Stack, so please bear with me if I breach any protocol.
I'm working on a project in Rails (2.1.2), and I have a relations scenario that looks like this:
event [has_many] days
People (in different categories) can sign up for event days, giving the following binding results:
category [has_many] custom...
Suppose I am developing a software for a pharmaceutical company where each 'ProductionLine' has multiple 'Stages' and each Stage has multiple 'Machines'
Now suppose I am maintaining three tables to record Stages and its Machines (leave the ProductionLine away for the shake of the discussion).
(1) Stage (Basic data which represents all ...
How can I associate an extension of a file to an program in Windows CE? It's so boring to run my Python programs using cmd. If I associate Python with my *.py files I'm going to run my program faster. Thanks!
...
Hi all,
I am trying to achieve what I think will be a fairly complex query using the magic of Rails without having lots of ugly looking SQL in the code.
Since my database is dealing with rather specialised biomedical models I'll translate the following to a more real world scenario.
I have a model Book that
has_many :chapters
and C...
Ok, stupid question. How do you remove a HABTM associated item without deleting the item itself? For instance, say I have 3 STUDENTS that are in SCIENCE class together. How do I remove the SCIENCE object from the STUDENTS_CLASSES table without deleting the actual SCIENCE reference? I'm guessing that Student.Classes.first.delete is...
For the purposes of the discussion I cooked up a test with two tables:
:stones and :bowls (both created with just timestamps - trivial)
create_table :bowls_stones, :id => false do |t|
t.integer :bowl_id, :null => false
t.integer :stone_id, :null => false
end
The models are pretty self-explanatory, and basic, but here they are:
...
I have an Entry model which has_many :tags. I want to be able to list my tags in an text input (ie. "tag-1, tag-2", etc.), however, I am running into an issue.
If I just use
form_for(:entry, form_options) do |f|
f.text_field :tags
end
My text box gets created, but is filled with something like #<Tag:0xb79fb584>#<Tag:0xb79faddc>, w...
Hi,
I have 2 entities: User and Company, with a FK from the User to the Company.
I'm trying to remove the association and leave the user entity with a scalar property "CompanyId", but still have the "Company" entity in the model (mainly to increase performance, I don't need to full entity attached to it).
I'm able to achieve that only ...
I've recently spent a good deal of time performing detailed UML designs of various SW components that I have since written. Looking back on what I have recently finished and comparing that to when I first learned UML, I see that I now almost strictly use Aggregation and Composition relationships, and have virtually abandoned "vanilla" no...
Hi
I know this is something simple I am doing wrong.
I have three tables, installation, neighborhood, schools
Installation:
has_many :schools
has_many :neighborhoods
Neighborhood:
has_many :installations
has_many :schools
Schools:
belongs_to :installations
belongs_to :neighborhoods
I can't figure out how to show the name...
In discussion about my answer to this question, there was some disagreement over how to model this code:
public class MainClass
{
private Something something;
public void Action()
{
OtherClass other = something.GetOtherClass();
}
}
The key points being:
the Something class is an attribute in MainClass, sugge...