property_hire/app/models/property_hire_setting.rb

21 lines
801 B
Ruby
Raw Normal View History

class PropertyHireSetting
include Mongoid::Document
include Mongoid::Timestamps
field :auto_approve, type: Boolean, :default => false
2021-09-06 16:45:14 +00:00
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 :disable_no_logins_view_calendar, 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?
2020-03-23 17:26:52 +00:00
self.first.auto_approve rescue false
end
2021-09-07 05:07:09 +00:00
after_save do
Property.init_class_variables
end
2021-10-23 02:34:18 +00:00
def default_time_settings
PropertyDaySetting.where(:property_id=>"default_settings").asc(:key)
end
end