Sha256: 36fd480989368a4186eeffc936ef750df9fe3b201dc5cea533d85a856723ad7f

Contents?: true

Size: 937 Bytes

Versions: 3

Compression:

Stored size: 937 Bytes

Contents

# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# !!! PLEASE KEEP THIS SCRIPT IDEMPOTENT !!!
#

User.as_anonymous_admin do
  Bookmark.without_auditing do
    bookmarks = [
      {:name => "list hypervisors", :query => 'hypervisor = true', :controller => "hosts"},
      {:name => "future", :query => 'starts > Today', :controller => "katello_subscriptions"},
      {:name => "expiring soon", :query => 'expires 30 days from now', :controller => "katello_subscriptions"},
    ]

    bookmarks.each do |input|
      next if SeedHelper.audit_modified? Bookmark, input[:name], :controller => input[:controller]
      b = Bookmark.find_or_create_by({ :public => true }.merge(input))
      fail "Unable to create bookmark: #{format_errors b}" if b.nil? || b.errors.any?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
katello-4.15.0 db/seeds.d/108-subcription-bookmarks.rb
katello-4.15.0.rc2 db/seeds.d/108-subcription-bookmarks.rb
katello-4.15.0.rc1 db/seeds.d/108-subcription-bookmarks.rb