Creating Tables at RUNTIME

I am confused about creating tables on runtime…
suppose i register to one website, and upon successful registration i
want to create a table with my name like—
Neo_Message is the table that i would like to create as soon as i
press the button name REGISTER. I am using MYSQL as database…Please
help me… thank you…

So you want to create a messages table for the user neo? You know that
it
would be much easier to create one messages table for everybody and then
link that to a specific user by specifying a user_id field in there as
well
as a has_many :messages on the user model, right?

On Mon, Mar 17, 2008 at 10:10 AM, Neo [email protected] wrote:

I am confused about creating tables on runtime…
suppose i register to one website, and upon successful registration i
want to create a table with my name like—
Neo_Message is the table that i would like to create as soon as i
press the button name REGISTER. I am using MYSQL as database…Please
help me… thank you…


Ryan B.
http://www.frozenplague.net
Feel free to add me to MSN and/or GTalk as this email.

yes i want to create table for each user. now as u told me … i am
thinkin should i name those table with user ids or name. also please
tell me how to do it in rails. i am tryin scaffold method and for that
i have also installed active scaffold plugin for rails. but still it
is not able to identify the method “active_scaffold” . i dont know y…

On Mar 16, 7:52 pm, “Ryan B. (Radar)” [email protected]

Yea, you don’t seem to understand relational databases and how data is
normally stored. Instead of having a new table for each user, you just
use foreign keys to mark that a particular record belongs to a user.

users table

– id
– name
– etc

messages table

– id
– user_id
– text

User model

has_many :messages

Message model

belongs_to :user

I don’t think you understand me.

I said to have ONE messages table for ALL users and inside that table
just
have a user_id field which references the user.

O… thanks after reading your first reply that thing was going on in
my mind… well now plans changed… will go your way…

On Mar 16, 10:34 pm, “Ryan B. (Radar)” [email protected]

Thanks for the help… I got it…will ask if i face new problem :slight_smile:

On Mar 16, 11:41 pm, Nathan E. <rails-mailing-l…@andreas-

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs