Displaying 5 results from an estimated 5 matches for "skolnick".
Did you mean:
bolnick
2006 Mar 02
5
Two foreign keys on the same column?
Let''s say I have three hypothetical MySQL tables:
? people, with columns id, gender, and source_id
belongs_to :boys and :girls
? boys, with columns id and name
has_many :people
? girls, with columns id and name
has_many :people
The gender column in people specifies which of the two source tables the
source_id refers to. For example, if we have values:
1, boy, 1
in people,
2006 Mar 24
4
habtm: attribute on join table
How do I retrieve the value of an attribute on my join table? For
example:
table ''people_places''
person_id
place_id
disposition
The first two use foreign keys and all that (I get that part). The value
of ''disposition'' is what I want.
--
Posted via http://www.ruby-forum.com/.
2006 Nov 17
4
before_destroy and sessions
(Semi-newbie.) I want to ensure a user''s able to destroy only his own
objects. I''ve set session info at login:
session[:user_id] = user.id
Now I try this in the model of my deletable objects:
before_destroy :destroy_your_own
def destroy_your_own
raise "Can''t delete that!" unless session[:user_id] == self.user.id
end
which snags EVERY attempted
2006 Apr 05
13
scaffold misuse?
Running ruby script/generate scaffold Product Admin
is a wonderful way to set up well, exactly what it says, a scaffold.
My problem is that I have several other tables that are linked,
through foreign keys, to the Product table. Say an "authors" table.
Now when I go enter a new product, a book, I want the application to
provide a drop down list of authors generated from the records in
2006 Apr 05
0
Fancy MySQL footwork
Database structure as follows:
t1 -> t2
-> t3 -> t4
select * from t1;
+----+-------+-------+
| id | t2_id | t3_id |
+----+-------+-------+
| 1 | 1 | null |
| 2 | null | 1 |
| 3 | null | 2 |
+----+-------+-------+
select * from t2;
+----+-------+
| id | title |
+----+-------+
| 1 | "hat" |
+----+-------+
select * from t3;
+----+-------+
| id | t4_id |