change_column :table_name, :column_name, :date
# rails g migration sample_name_change_column_type
def change
change_column(:table_name, :column_name, :new_type)
end
class CreateProducts < ActiveRecord::Migration
def change
create_table :products do |t|
t.string :name
t.text :description
t.timestamps
end
end
end
Code Example |
---|
Ruby :: ruby reference a file in a gem |
Ruby :: ruby get file name |
Ruby :: devise redirectt after sign up |
Ruby :: ruby iterate over array |
Ruby :: rails get source method |
Ruby :: create rails project with postgres |
Ruby :: rails migration update column default value |
Ruby :: ruby catch all exceptions |
Ruby :: rails strftime |
Ruby :: ruby find index of element in array |
Ruby :: rails crud |
Ruby :: add column with default value in rails |
Ruby :: how to generate a controller in rails |
Ruby :: ruby not include |
Ruby :: array to hash ruby |
Ruby :: ruby debugger |
Ruby :: rails faker |
Ruby :: ruby create array |
Ruby :: ruby each |
Ruby :: grails 3 cron jobs |
Ruby :: ffi gem error mac |
Ruby :: ruby reduce hash |
Ruby :: ruby array with unique values |
Ruby :: map each with index |
Ruby :: Validate French phone numbers |
Ruby :: find_by column name rails route |
Ruby :: common functions in rails |
Ruby :: og meta tags not working rails |
Ruby :: height of a tree in ruby |
Ruby :: redis localhost url |