class SiteRequest include Mongoid::Document include Mongoid::Timestamps include Slug field :site_id field :host_with_rulingdigital, type: Boolean, default: false field :server_details field :optional_modules, type: Array, default: [] field :custom_module, type: Boolean, default: false field :custom_module_details field :template_number field :custom_template, type: Boolean, default: false field :custom_template_details field :rwd, type: Boolean, default: false field :sites_to_add, type: Array, default: [] field :completed, type: Boolean, :default => false field :type belongs_to :site_purchase belongs_to :request_contract belongs_to :c_panel_user def get_site self.site_id == "newsite" ? nil : RegisteredSite.find(self.site_id) end def get_site_type case self.type when "newsite" t = "New Site" when "existing" t = "New Feature" when "addsites" t = "Sites Addition" end t end end