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.. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 <vachhaninimit-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 Bigg (Radar)" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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 <vachhanini...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 Bigghttp://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 Bigg (Radar)" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for the help... I got it..will ask if i face new problem :) On Mar 16, 11:41 pm, Nathan Esquenazi <rails-mailing-l...@andreas- s.net> wrote:> 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 > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---