Posted by Herbert Poul |
|
waaa.. it always uses the beer_id also for id:
mysql> select * from bars_beers; +----+--------+---------+ | id | bar_id | beer_id | +----+--------+---------+ | 1 | 3 | 1 | | 2 | 2 | 2 | | 3 | 2 | 3 | | 4 | 2 | 4 | | 5 | 2 | 5 | | 6 | 1 | 6 | +----+--------+---------+ 6 rows in set (0.00 sec) i can't add the same beer to more than one bar.. that is not really what i meant with ... many-to-many .. Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
well.. i actually have no idea what i did wrong .. i will simply drop the table and recreate it by hand.. i don't want to play around with migration files any more ... it's getting boring .. Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
mysql> drop table bars_beers;
Query OK, 0 rows affected (0.00 sec) mysql> create table bars_beers (bar_id integer not null references bars (id), beer_id integer not null references beer (id), primary key (bar_id, beer_id)); Query OK, 0 rows affected (0.00 sec) Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
better .. it works now :) Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
ok .. i'll now give authentication a try ...
http://wiki.rubyonrails.com/rails/pages/Acts_as_authenticated Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
ok .. the documentation says:
during one of those commands:
anyway .. i believe the documentation for now :) since i have no desire to look any further.. Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
ok, i'm almost there now .. adding comments ... Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
migration file i came up with:
class Comments < ActiveRecord::Migration def self.up create_table :comments do |table| table.column :bar_id, :integer table.column :user_id, :integer table.column :postdate, :timestamp table.column :body, :text end end def self.down drop_table :comments end end Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
ok.. comments are working .. Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
ok... i think ..
i'm done... (although i'm not really satisfied with the results) Hey, we have Signatures !!! Great, isn't it ? ;) |