Skip to content
Snippets Groups Projects
Commit b27e138f authored by ArtOfCode-'s avatar ArtOfCode-
Browse files

Fix privilege seeding

parent 644e6fef
No related merge requests found
......@@ -7,5 +7,5 @@ class Privilege < ApplicationRecord
has_and_belongs_to_many :users
validates :name, uniqueness: true
validates :name, uniqueness: { scope: [:community_id] }
end
......@@ -4,7 +4,13 @@ require 'redcarpet/render_strip'
Rails.application.eager_load!
Dir.glob(Rails.root.join('db/seeds/**/*.yml')).each do |f|
if ENV['SEEDS'].present?
find_glob = "db/seeds/**/#{ENV['SEEDS'].underscore}.yml"
else
find_glob = 'db/seeds/**/*.yml'
end
Dir.glob(Rails.root.join(find_glob)).each do |f|
basename = Pathname.new(f).relative_path_from(Pathname.new(Rails.root.join('db/seeds'))).to_s
type = basename.gsub('.yml', '').singularize.classify.constantize
begin
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment