Dear all, I am in process of interfacing web with a chat tool. Iam using rails 2.0.2 and mysql. i have created a database chat_development, with table names userinfos, clientinfos. I dont want the defaults, i need to set the table name like, user_info and client_info. i have used set_table_name method like, class Userinfo < ActiveRecord::Base set_table_name "user_info" end I have even set the environment.rb file like, ActiveRecord::Base.pluralize_table_names = false when i gave rake db:migrate , all files are migrated well but the table names are not changed in my DB. what i need to do to change the table names of my own. Please suggest Thanks in advance Regards, Jose Martin -- 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 -~----------~----~----~----~------~----~------~--~---
On 18 Sep 2008, at 12:37, dare ruby wrote:> > I dont want the defaults, i need to set the table name like, user_info > and client_info. i have used set_table_name method like, > > class Userinfo < ActiveRecord::Base > set_table_name "user_info" > end > > I have even set the environment.rb file like, > > ActiveRecord::Base.pluralize_table_names = false > > when i gave rake db:migrate , all files are migrated well but the > table > names are not changed in my DB. what i need to do to change the table > names of my own. Please suggest >Those settings just control what table Rails will try to use for a given class - they''ll never change the schema. If you want to change the schema, write a migration. Fred>--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> > If you want to change the schema, write a migration. >Dear fred, Thanks for your immediate response, how to perform migration for the above. I have no idea? could you please suggest. Thanks in advance Regards, Jose martin -- 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 -~----------~----~----~----~------~----~------~--~---
dare ruby wrote:> >> >> If you want to change the schema, write a migration. >> > > Dear fred, > > Thanks for your immediate response, how to perform migration for the > above. I have no idea? could you please suggest. > > Thanks in advance > > Regards, > Jose martinits simple... rename_table(old_table_name, new_table_name) -- 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 -~----------~----~----~----~------~----~------~--~---