app/models/simplec/subdomain.rb in simplec-0.4.2 vs app/models/simplec/subdomain.rb in simplec-0.4.3
- old
+ new
@@ -1,30 +1,30 @@
module Simplec
class Subdomain < ApplicationRecord
- has_many :pages
- has_and_belongs_to_many :document_sets
- has_and_belongs_to_many :documents
+ has_many :pages
+ has_and_belongs_to_many :document_sets
+ has_and_belongs_to_many :documents
- validates :name,
- presence: true,
- exclusion: { in: %w(admin) }
- validates :default_layout,
- inclusion: {in: :layouts, allow_blank: true}
+ validates :name,
+ presence: true,
+ exclusion: { in: %w(admin) }
+ validates :default_layout,
+ inclusion: {in: :layouts, allow_blank: true}
- def layouts
- @layouts ||= Dir[Rails.root.join('app/views/layouts').to_s + "/*.html.*"].
- map{|n| File.basename(n).split('.', 2).first }.
- reject{|n| n =~ /\A_/ || n =~ /mailer/ || n =~ /application/ || n =~ /sessions/}.
- sort
- end
+ def layouts
+ @layouts ||= Dir[Rails.root.join('app/views/layouts').to_s + "/*.html.*"].
+ map{|n| File.basename(n).split('.', 2).first }.
+ reject{|n| n =~ /\A_/ || n =~ /mailer/ || n =~ /application/ || n =~ /sessions/}. # TODO application and session should be removed and added to a config option
+ sort
+ end
- module Normalizers
+ module Normalizers
- # Force lowercase name
- #
- def name=(val)
- super (val ? val.to_s.strip.downcase : val)
- end
- end
- prepend Normalizers
+ # Force lowercase name
+ #
+ def name=(val)
+ super (val ? val.to_s.strip.downcase : val)
+ end
+ end
+ prepend Normalizers
end
end