Sha256: 0bf0dcd4eebd5d96a18afa28d667c728bd569dd466b405bc60f989a4ff7b998e
Contents?: true
Size: 632 Bytes
Versions: 35
Compression:
Stored size: 632 Bytes
Contents
class RemoveTrailingSlashesInTaxonPermalinks < ActiveRecord::Migration def up taxons = select_all "SELECT * FROM taxons" taxons.each do |taxon| if taxon['permalink'] && taxon['permalink'][-1..-1] == '/' execute "UPDATE taxons SET permalink = '#{taxon['permalink'][0...-1]}' WHERE id = #{taxon['id']}" end end end def down taxons = select_all "SELECT * FROM taxons" taxons.each do |taxon| if taxon['permalink'] && taxon['permalink'][-1..-1] != '/' execute "UPDATE taxons SET permalink = '#{taxon['permalink'] + '/'}' WHERE id = #{taxon['id']}" end end end end
Version data entries
35 entries across 35 versions & 3 rubygems