Migrations in rails

0

Is there any way that by generating a scaffold per console you can choose the name of the table that generates the migration ?, this in order to work with a mer designed in Spanish. / p>     

asked by Miguel Angel Gonzalez Jaimen 11.10.2016 в 15:36
source

1 answer

3

bin/rails generate migration CreateProducts name:string part_number:string

It will generate a migration that will create a Products table with two fields name and part_number of type string .

class CreateProducts < ActiveRecord::Migration[5.0]
  def change
    create_table :products do |t|
      t.string :name
      t.string :part_number
    end
  end
end

link

    
answered by 11.10.2016 в 18:09