Table name: universities
id :integer not null, primary key name :string(255) subdomain :string(255) active :boolean default(FALSE) created_at :datetime updated_at :datetime
It return the configuration array for the current university.
# File app/models/university.rb, line 33 def find_or_build_configurations Configuration.sub_configurations.each do |c| configurations.build(type: c.name) unless configurations.exists?(type: c.name) end configurations end
Reindex elasticsearch.
# File app/models/university.rb, line 46 def reindex_elasticsearch ActsAsTenant.with_tenant(self) do [Student, Tutor, Course, Subject, Category].each do |model| puts "Deleting Index - #{model.index_name}" model.__elasticsearch__.delete_index! puts "finished Delete. now Creating index #{model.index_name}" model.__elasticsearch__.create_index! puts "updating index for #{model.index_name}" index = 0 model.find_each do |object| begin object.__elasticsearch__.index_document print "\r#{index+=1} records updated" rescue => e puts "unable to update index for #{object.id} - #{e}" end end puts "\n" end end end
Returns subdomain for university.
# File app/models/university.rb, line 28 def to_param subdomain end
Returns url for university site.
# File app/models/university.rb, line 41 def url "#{subdomain}.#{ActionMailer::Base.default_url_options[:host]}" end