Displaying 20 results from an estimated 3000 matches similar to: "multiple columns primary key"
2007 Nov 22
2
Active Record Question
hey!
I have the following table structure in my DB
| users |
------------
| (pk)id |
| username |
| pass |
------------
(1:n)
| users_objects | | objectattributes |
------------------ ----------------------------------
| (fk,pk)user_id | (1:n) | (pk)attribute |
|(fk,pk)object_id| | (pk,fk)
2007 Aug 30
1
belongs_to with foreign keys that reference non primary key columns
Hello,
I have a situation where the foreign key into a table doesn''t
correspond to that table''s primary key:
my_table
-------------
id (pk)
name
...
other_table
--------------
id (pk)
my_table_name (fk references my_table(name))
...
I want to be able to say something like:
class OtherTable < ActiveRecord::Base
belongs_to :my_table, :foreign_key => { :my_table_name
2006 Jan 21
7
n-way joins
Hi,
I''m somewhat of a Rails newbie and am trying to understand how to
formulate n-way (3 or 4 way) joins in Rails (where the join tables
contain extra data as well.)
Let me give you my basic entities:
foos
id - pk
name - unique
bars
id - pk
name - unique
bazs
id - pk
name - unique
frozs
id - pk
name - unique
then i have two separate join tables:
foos_bars_bazs - 3 way join
2009 Oct 08
6
Eager Loading a Relationship That Has No PK/FK
I''m attempting to wrestle an old DB into Rails.
This relationship is giving me trouble:
class Show < AR::Base
has_many :segments
end
class Segment < AR::Base
belongs_to :show
has_one :media #this has no PK/FK relation
end
A Segment is "linked" to Media by Media.name, which is the result of
concatenating Segment.name and Segment.part. As I said there are is no
2006 Jun 30
4
ActiveRecord Migrations, without autonumbered PK''s
I love using ActiveRecord Migrations to build tables.
Sometimes, I don''t want to use autogenerated PK''s - I want to set them
automatically (why? I''m importing read only data from a large list of
medications, and want to use the PK''s assigned by the medication
research company...). Is there anyway to do this using Migrations? I
know that I don''t
2006 Jun 09
2
Support for clustered primary key in rails?
Hi, I need to support a legacy database that mostly uses clustered
primary keys (i.e. every primary key consiststs of multiple fields not
just a single one. E.g. if I have tables A,B and C and C depends on
tables A and B, then C''s primary key will consist of 3 or more fields-
the foreign key fields pointing to A and B and a field or fields from C
that will make C unique- in
2007 Oct 21
13
[ANN/RFC] Rathole, a fixtures extension plugin
Like lots of other folks, I''ve been searching for a way to scratch my
fixture itches. Rathole is my extraction of a few techniques we''ve
successfully applied at my day job.
We''ve been using Rathole for a month or so now, but I''d really like
some feedback from a wider audience. Rathole tackles:
* Conflicting PK''s (no more id''s in fixture
2007 Aug 02
4
ActiveRecord Limitation (Advance)
Or is it ?
Need to be able to :-
@search =
Form.find(:all, :include=>[:form_type, :form_type_items], :conditions=>....)
I need in the Form model a :form_type_items, the question is, what is
the relationship type?
Current Models:-
Form
belongs_to :form_type
FormType
has_many :form_types
has_many :form_type_items
FormTypeItem
Belongs_to :form_type
Form
----------------
| id |
2005 Nov 16
1
HABTM: deleting records based on attributes
Hello All,
I am new to ROR, and can''t seem to get HABTM to cooperate entirely...
however I might be abusing it! Before I try a different strategy I
thought I''d ask here and see if I''m missing something simple.
So say Projects and Companies are related. Projects can have multiple
Companies, and Companies can be on multiple Projects. But, the same
Company can also
2006 Mar 20
11
has_many brings back ''uninitialized constant''
hello. first things first - I am new to ruby on rails (ruby, too), so
I''m figuring this is just a basic newbie error.
I''m creating a basic photography website. And I have two tables with a
relationship:
photos:
- id (set up as PK)
- title
- shutter
- aperture
- date
- the_order
...etc
photo_comments:
- id (set up as a PK)
- photos_id (set up as a FK)
- author
- date
-
2010 Aug 19
1
Composite primary keys and :joins=>
I have a legacy db with the following simplified structure:
Table-A:
type_key, code_key, name, ... # PKs are type_key and code_key,
there is no id col and I cannot alter this db
Table-B: # each row has only the code as a foreign_key, the type_key
is hard-coded to "FOOKEY"
an_id, code, ...
Models:
class TableB < AR::Base
set_table_name ''table_b''
2006 Jul 10
18
Deleting join association of has_many :through
I''m trying to use has_many :through, since my join model deserves being
more than just an intersection table.
But when I try to break the association, the break only seems
"temporary":
Let''s say my two tables are Users and Colors, and the join model is
Favorites.
user = Users.find(1)
user.colors.length
>> 2
c = user.colors.first
>> #<Color:....>
2010 Jan 27
2
RMySQL - Bulk loading data and creating FK links
I have a table (contact) with several fields and it's PK is an auto
increment field. I'm bulk loading data to this table from files which if
successful will be about 3.5million rows (approx 16000 rows per file).
However, I have a linking table (an_contact) to resolve a m:m
relationship between the an and contact tables. How can I retrieve the
PK's for the data bulk loaded into
2008 Mar 29
3
primary key?
can you use 2 pirmary keys.
the standard user_id key exists but i would also like to use another
key for my links. i am not sure how to implement this. also i don''t
want any auto incrementing of this second primary key that i would
like to use for my relationships.
if there is a good db, model, relationship tutorial out there i would
love to know about it.
2007 Sep 04
2
Use of uniqueidentifer type for primary key?
I''m working on a legacy SQL db. It is distributed, to they are using
the uniqueidentifier type for the primary key.
At first, at least, I won''t be updating records, but I''m seeing a lot
of negativity about using anything other than incrementing integers
for the pk--which are obviously inadequate for this environment.
It is enough to use set_primary_key? Do I need
2012 Jun 13
2
[LLVMdev] llvm-mc problem after a pass
Hi,
I'm having some problem with llvm-mc on a program after applying a pass:
../../../build/Release+Asserts/bin/clang -emit-llvm -c -I./testprof/ -I./src/headers/ -I../libtommath-0.42.0/ -Wall -Wsign-compare -W -Wshadow -Wno-unused-parameter -DLTC_SOURCE -O0 -DLTC_NO_ASM -DUSE_LTM -DLTM_DESC -o src/pk/asn1/der/sequence/der_encode_sequence_ex.bc
2009 May 17
3
build CONTENTS or 00Index.html without installing whole package
To maintain my R site, I'm trying to install html help files only, but
also keep track of the version (with DESCRIPTION). I have the
following bash script, which works except for 00Index.html. That is
not a huge problem because the help files are still searchable, but
I'd like to fix it.
A long time ago I asked the same question, and Brian Ripley said to
use --index as an option to
2008 Jul 14
3
Loop problem
Dear all,
I want to
write ck<-cbind(rep(pk[1,1],4),rep(pk[1,2],4),rep(pk[1,3],4)) state ment
in a loop . How can I write it ?
> pk
[,1] [,2] [,3]
[1,] -1.1354816 0.9808877 -0.9446314
[2,] 0.7787378 0.4536944 0.3204882
[3,] -1.7274907 1.5112011 1.4481839
[4,] 1.0629145 0.5976109 -0.5277638
> pk<-matrix(rnorm(12),nrow=4,ncol=3)
> pk
2012 Jun 13
0
[LLVMdev] llvm-mc problem after a pass
Something is adding a bogus comment string. Specifically " # %case^M18 ", where "^M" is a single ctrl-M character.
The ^M is seen by the asm parser as an end-of-line, so the '18' is a new token at the start of a line, not part of the comment. Is your pass perhaps using label names which might include literal "^M" characters?
-Jim
On Jun 13, 2012, at
2009 Jul 14
2
hi friends, is there any wait function in R
hi,
is there any wait function in R. I am running one R script to plot
many graphs it is in the for loop. its showing no error but its not
plotting well I think i can solve this problem with a wait function.
Please help me in this regards. If u need any clarification about
programme. u can find the script below.
best regards,
Deepak.M.R
Biocomputing Group
University of Bologana.
#!/usr/bin/R