ensl.org/db/migrate/20200331020637_add_title_to_directories.rb
2020-03-31 06:36:19 +03:00

12 lines
273 B
Ruby

class AddTitleToDirectories < ActiveRecord::Migration[6.0]
def change
change_table :directories do |m|
m.string :title
end
Directory.all.each do |dir|
dir.title = dir.name
dir.name = File.basename(dir.path)
dir.save!
end
end
end