clarion/db/migrate/20150712103031_create_slugs_for_existing_conferences.rb
2015-07-12 11:05:38 +03:00

14 lines
280 B
Ruby

class CreateSlugsForExistingConferences < ActiveRecord::Migration
class Conference < ActiveRecord::Base
end
def change
Globalize.with_locale(:en) do
Conference.find_each do |c|
c.slug = c.title.gsub(/\s+/, '-')
c.save!
end
end
end
end