Could ActiveRecord add some comments for a column when create a table?For example use some sentence like this: create_table :blogs do |t| t.string, :blog_title, :limit=>100,:null=>false, :comment=>''my blog title'' end After do this,I can use the comment instead of the human name of column,it''s more suitable. -- 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 -~----------~----~----~----~------~----~------~--~---
Mark Bush
2008-Mar-12 08:34 UTC
Re: Could ActiveRecord add some comments when create table
Wu Junchen wrote:> Could ActiveRecord add some comments for a column when create a > table?Column comments are not part of the table as such and not available in all databases. The normal solution for this sort of requirement is to encode it yourself. In your migration, use something like: class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.string :name t.datetime :dob t.timestamps end if config[RAILS_ENV][''adapter''].match(/oracle|oci/) execute "comment on column users.name is ''The username of the user''" end end : -- 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 -~----------~----~----~----~------~----~------~--~---