ensl.org/db/migrate/20200331020637_add_title_to_directories.rb

13 lines
278 B
Ruby
Raw Normal View History

class AddTitleToDirectories < ActiveRecord::Migration[4.2][6.0]
2020-03-31 03:36:19 +00:00
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