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?

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..

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.

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

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

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