Project

General

Profile

« Previous | Next » 

Revision 8809a63b

Added by Stephen Benjamin over 8 years ago

fixes #9654 - mark seeded org/loc as default

View differences:

db/seeds.d/05-taxonomies.rb
if SETTINGS[:organizations_enabled] && ENV['SEED_ORGANIZATION'] && !Organization.any?
Organization.without_auditing do
User.current = User.anonymous_admin
Organization.find_or_create_by_name!(:name => ENV['SEED_ORGANIZATION'])
org = Organization.find_or_create_by_name!(:name => ENV['SEED_ORGANIZATION'])
Setting[:default_organization] = org.title if Setting[:default_organization].blank?
User.current = nil
end
end
......
if SETTINGS[:locations_enabled] && ENV['SEED_LOCATION'] && !Location.any?
Location.without_auditing do
User.current = User.anonymous_admin
Location.find_or_create_by_name!(:name => ENV['SEED_LOCATION'])
loc = Location.find_or_create_by_name!(:name => ENV['SEED_LOCATION'])
Setting[:default_location] = loc.title if Setting[:default_location].blank?
User.current = nil
end
end

Also available in: Unified diff