Sha256: e4beeb25df0d769979c9de663da320feca93636f9b1682972be14d82c446878c
Contents?: true
Size: 694 Bytes
Versions: 7
Compression:
Stored size: 694 Bytes
Contents
# This migration comes from spree (originally 20110314192118) 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
7 entries across 7 versions & 2 rubygems