relationships

View with products linking to product pages with Taxonomy

Hi, I’m kind of in a jam with a website I’m trying to create for use in a technical department which will server as a information database for the repair engineers to find information about products they are working on. This will include testing procedures, product configuration pages, customer specific information per product, software ...

Name a reference in ActiveRecord

in my rails app, I have an Organization model, with a reference to a User, which I want to be able to access via organization_instance.adminstrator. I'm not sure how to accomplish this using the belongs_to method. ...

CakePHP Relationship Question

I am trying to configure CakePHP to act as a REST API for an app i'm writing. I have 3 tables: dishes { id, name, description } users { id, name, email } dishes_users { id, user_id, dish_id } I would like it so that when someone visits /users/1.xml, the data that gets returns is just the list of 'dishes' that a user has in...

Rails accepts_nested_attributes_for child doesn't have parent set when validating

I'm trying to access my parent model in my child model when validating. I found something about an inverse property on the has_one, but my Rails 2.3.5 doesn't recognize it, so it must have never made it into the release. I'm not sure if it's exactly what I need though. I want to validate the child conditionally based on parent attri...

which cakephp relationship should be used for groups of users? can haveMany use array for foreign_ID?

In my tennis application, my 'match' table has two players (obviously). I've used player1_id and player2_id as a way to track the user ids. I haven't included a user_id foreign key though. There is also a 'user' table where I want to pull player's names from. Because 'match' has more than one user and users have more than one model, ...

Database relationships using phpmyAdmin (composite keys)

Hi, I am bit confused on making a good relational database. I am using phpmyAdmin to create a database. I have the following four tables. Don't worry about that fact place and price are optional they just are. Person (Mandatory) Item (Mandatory) Place (Optional) Price (Optional) Item is the main table. It will always have person...

InnoDB - Two foreign keys on the same column from one table

Hey Guys, i have a project table which has a image_id field and a newsimage_id field. Both are linked to the image table. But InnoDB doesn't allow me to set a foreign key for both fields to the same column (id). Is there a way I can do this or is it not possible? I'm using MySQL through MAMP. Thanks in advance!! ...

Django generic relation field reports that all() is getting unexpected keyword argument when no args are passed.

I have a model which can be attached to to other models. class Attachable(models.Model): content_type = models.ForeignKey(ContentType) object_pk = models.TextField() content_object = generic.GenericForeignKey(ct_field="content_type", fk_field="object_pk") class Meta: abstract = True class Flag(Attachable): ...

What is the best way to setup my tables and relationships for this use case?

1)A user can have many causes and a cause can belong to many users. 2)A user can have many campaigns and campaigns can belong to many users. Campaigns belong to one cause. I want to be able to assign causes or campaigns to a given user, individually. So a user can be assigned a specific campaign. OR a user could be assigned a cause and...

Core Data migration of to-one relationship to to-many relationship

I have a deployed app that samples measurements from sensors (e.g., Temp °C, Pressure kPa). The user can create Experiments and collect samples. Each sample is stored as a Run, such that there is a one-to-many relationship from Experiment to Run. In the interest of performance, Run has a to-one relationship with Data entity (which is whe...

Need help with many-to-many relationships....

I have a student and faculty table. The primary key for student is studendID (SID) and faculty's primary key is facultyID, naturally. Student has an advisor column and a requested advisor column, which are foreign key to faculty. That's simple enough, right? However, now I have to throw in dates. I want to be able to view who their advi...

Setting SQL Relationships For LINQ Queries

I have two tables that I'm trying to create a relationship between so I can write nice LINQ queries that don't require join. Widgets WidgetId WidgetDescription Orders OrderId WidgetId OrderDate What I want to be able to do is create a LINQ query that does something similar to: var result = from x in db.Widgets Where x.Orders.Order...

Refinery CMS (Rails): Creating a plugin or plugins with multiple models and relationships

My goal is to create a way for an admin to create two models in the Refinery admin: Campaigns and Videos I would like to have it setup so that a Campaign has many Videos and that each Video belongs to a Campaign. Both Videos and Campaigns will have a title, description, and a preview image. I'm not certain of the best way to go about...

Core Data - Entity Relationships Not Working as expected

I have set up my data model in xcode like so EntityA AttA1 AttA2 EntityB AttB1 AttB2 AttB3 I then set up the relationships EntityA Name: rlpToEntityB Destination: EntityB Inverse: rlpToEntityA To Many: Checked EntityB Name: rlpToEntityA Destination: EntityA Inverse: rlpToEntityB To Many: UnChecked i.e. relationship...

Many-to-Many Relationship (with properties) in Google App Engine for Java

I understand from the official documentation on unowned relationships that the app must use sets of Key objects on either side of the relationship. This makes perfect sense. Coming from many years of RDBM-style programming, though, I'm pretty confused about how I can model properties of that relationship itself. For example, if I have ...

Is it possible to add WHERE clauses when retrieving relationships?

In doctrine, is it possible to add a WHERE clause when fetching a property of an object that corresponds to a relationship? In terms of concept, let's say I want to retrieve only the first 3 blog posts made in the last 5 days. My "blog" object has a "posts" property which is defined as a relationship. Update... As some people are hav...

Why am I getting an undefined property error when my relationships seem correct?

I'm having a slight problem that I can't figure out, but should be really simple. I have the following model structure in my cakePHP (1.3) app: ProspectiveQuote [hasMany] QuoteUnit [belongsTo] Unit but in my ProspectiveQuotesController the line: $this->ProspectiveQuote->QuoteUnit->Unit->find('list'); gives me the following error:...

Many-to-Many Relationships in Rails

I have two models I want to connect with an m-to-m relationship, but I want the relationship to have some data of its own, such as a date due or a count or something like that... Suppose I have Users, Groups, and some UsersInGroups object, where users and groups both have a has_many X, :through Y relationship. UsersInGroups belongs_to a...

Convert many to many to one to one (mysql)

We changed database schema and moved a relationship between users/accounts from a 1-1 to a many to many using a join table accounts_users. So we have accounts, users, accounts_users (user_id and account_id) Our data is still 1-1, and we have decided to move back. So I need sql to move back: To Migrate I used: INSERT INTO accounts_us...

Create list of nodes that are referenced at least once

I'm sure this is simple with the Node Relationship module but I can't wrap my head around it. I have a list called 'Comedian Profile' which has a node reference field for it. You then make - you guess it - profiles for comedians. To make an 'Events' (that doubles as an Ubercart item) you select the comedian. It then creates a view in th...