2013-07-18 10:08:48 +00:00
|
|
|
Gitlab::Seeder.quiet do
|
2014-10-16 13:50:09 +00:00
|
|
|
content =<<eos
|
|
|
|
class Member < ActiveRecord::Base
|
|
|
|
include Notifiable
|
|
|
|
include Gitlab::Access
|
|
|
|
|
|
|
|
belongs_to :user
|
|
|
|
belongs_to :source, polymorphic: true
|
|
|
|
|
|
|
|
validates :user, presence: true
|
|
|
|
validates :source, presence: true
|
|
|
|
validates :user_id, uniqueness: { scope: [:source_type, :source_id], message: "already exists in source" }
|
|
|
|
validates :access_level, inclusion: { in: Gitlab::Access.all_values }, presence: true
|
|
|
|
|
|
|
|
scope :guests, -> { where(access_level: GUEST) }
|
|
|
|
scope :reporters, -> { where(access_level: REPORTER) }
|
|
|
|
scope :developers, -> { where(access_level: DEVELOPER) }
|
|
|
|
scope :masters, -> { where(access_level: MASTER) }
|
|
|
|
scope :owners, -> { where(access_level: OWNER) }
|
|
|
|
|
|
|
|
delegate :name, :username, :email, to: :user, prefix: true
|
|
|
|
end
|
|
|
|
eos
|
2013-07-18 10:08:48 +00:00
|
|
|
|
|
|
|
(1..50).each do |i|
|
|
|
|
user = User.all.sample
|
|
|
|
|
|
|
|
PersonalSnippet.seed(:id, [{
|
|
|
|
id: i,
|
|
|
|
author_id: user.id,
|
2013-07-18 10:21:56 +00:00
|
|
|
title: Faker::Lorem.sentence(3),
|
2014-10-16 13:50:09 +00:00
|
|
|
file_name: Faker::Internet.domain_word + '.rb',
|
|
|
|
visibility_level: Gitlab::VisibilityLevel.values.sample,
|
|
|
|
content: content,
|
2013-07-18 10:08:48 +00:00
|
|
|
}])
|
2014-10-16 13:50:09 +00:00
|
|
|
|
2013-07-18 10:08:48 +00:00
|
|
|
print('.')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|