In Rails we have command to add migration that specifies the table name column name. For example : $ rails generate migration AddPartNumberToProducts part_number:string will generate class AddPartNumberToProducts < ActiveRecord::Migration def change add_column :products, :part_number, :string endend I know we can add the options on migration file, below migration will add part_number column after description column on products table. class AddPartNumberToProducts < ActiveRecord::Migration def change add_column :products, :part_number, :string, :after => :descritpion endend *Problem: How to specify the options (example :after => :descritpion) on command line so that it will add directly on migration file.* FYI : I''ve asked the same question on stackoverflow Link http://stackoverflow.com/questions/17720849/rails-migration-generation-with-options -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/036f33b5-5343-4b38-a572-a45a8a69b419%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Robert Walker
2013-Jul-25 16:14 UTC
Re: Rails migration generation with options or defaults
Kirankumar Skk wrote in post #1116632:> In Rails we have command to add migration that specifies the table name > column name. For example : > > $ rails generate migration AddPartNumberToProducts part_number:string > > *Problem: How to specify the options (example :after => :descritpion) on > command line so that it will add directly on migration file.*Allowing you to specify the columns on the command line generator is a convenience feature. It was never intended to provide the full range of options that can be specified in the actual migration. There is a limited set of additional options you can specify on the command line as detailed in section 2.3 of the following guide: http://guides.rubyonrails.org/migrations.html#model-generators -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/cb33e0839821891f17393362890f1607%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.