i already have 10_create_comments migration file. that file contains create_table :comments do |t| t.column :title, :text t.column :foto_id, :integer t.column :user_id, :integer t.column :created_at, :datetime t.column :updated_at, :datetime end this is design for photo commenting purpose. i i need another comment setup under the message so how do i use this migration file to that? any ideas? nirosh -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Your current create_table should appear in the self.up section of the migration... self.down should undo any operation that self.up performs (where reasonable). There''s nothing stopping you from adding another create_table statement as long as its properly formatted. You''ll probably hear all sorts of opinions about mixing more than one action in a single migration step. If you do create more than one table, realize that the migration becomes an all or nothing choice, both tables or neither. You can code it however you want of course, but what is so bad about adding another migration for the message comments? From my point of view, what you really want is a polymorphic join between comments and several (at least two) other models in your application. Check out has_many_polymorphs, and simplify your development. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.