trabajo-afectivo/app/models/concerns/can_seed.rb

25 lines
497 B
Ruby
Raw Normal View History

2022-01-01 13:38:12 +00:00
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
module CanSeed
extend ActiveSupport::Concern
# methods defined here are going to extend the class, not the instance of it
class_methods do
def reseed
destroy_all
seed
end
def seed
UserInfo.ensure_current_user_id do
load seedfile
end
end
def seedfile
2017-11-23 08:09:44 +00:00
Rails.root.join('db', 'seeds', "#{name.pluralize.underscore.tr('/', '_')}.rb").to_s
end
end
end