Sha256: 75aa15a34c41cdb5bce6b7cff9ecf380fb9128fafc6ad18e83ab3554ef0a1f88

Contents?: true

Size: 603 Bytes

Versions: 5

Compression:

Stored size: 603 Bytes

Contents

# frozen_string_literal: true

# Ensures that all navigation items have a valid target and http_method.
class UpdateTargetSyntax < ActiveRecord::Migration[7.0]
  # rubocop:disable Rails/SkipsModelValidations
  def change
    Katalyst::Navigation::Item.where(http_method: nil).update_all(http_method: "get")
    Katalyst::Navigation::Item.where(target: nil).update_all(target: "self")
    Katalyst::Navigation::Item.where(target: "_blank").update_all(target: "blank")
    Katalyst::Navigation::Item.where(target: "_top").update_all(target: "top")
  end
  # rubocop:enable Rails/SkipsModelValidations
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
katalyst-navigation-1.8.4 db/migrate/20230727025052_update_target_syntax.rb
katalyst-navigation-1.8.3 db/migrate/20230727025052_update_target_syntax.rb
katalyst-navigation-1.8.2 db/migrate/20230727025052_update_target_syntax.rb
katalyst-navigation-1.8.1 db/migrate/20230727025052_update_target_syntax.rb
katalyst-navigation-1.8.0 db/migrate/20230727025052_update_target_syntax.rb