Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class AddRandomSlugToReports < ActiveRecord::Migration
- def self.up
- change_table :reports do |t|
- t.string :slug
- t.index :slug
- end
- Report.reset_column_information
- Report.all.each do |report|
- report.generate_slug!
- report.save
- end
- end
- def self.down
- change_table :reports do |t|
- t.remove :slug
- t.remove_index :slug
- end
- end
- end
Add Comment
Please, Sign In to add comment