property_hire/app/models/property_hire_setting.rb

17 lines
619 B
Ruby

class PropertyHireSetting
include Mongoid::Document
include Mongoid::Timestamps
field :auto_approve, type: Boolean, :default => false
field :carousel_image_width, type: String, :default => "75%"
field :disable_content_page, type: Boolean, :default => false
field :disable_view_calendar_page, type: Boolean, :default => false
field :allow_no_logins_user, type: Boolean, :default => false
field :calendar_type, type: Integer, default: 0 # 0=> 顯示, 1=> 不顯示
def self.auto_approve_enabled?
self.first.auto_approve rescue false
end
after_save do
Property.init_class_variables
end
end