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
On 18 Sep 2008, at 12:37, dare ruby wrote:
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
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
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 martin
its simple…
rename_table(old_table_name, new_table_name)