class IntercomRails::Proxy::Company

Public Class Methods

current_in_context(search_object) click to toggle source
# File lib/intercom-rails/proxy/company.rb, line 14
def self.current_in_context(search_object)
  begin
    if config.current.present?
      company_proxy = new(search_object.instance_eval(&config.current), search_object)
      return company_proxy if company_proxy.valid?
    end
  rescue NameError
  end

  raise NoCompanyFoundError
end

Public Instance Methods

valid?() click to toggle source
# File lib/intercom-rails/proxy/company.rb, line 26
def valid?
  return false if company.blank? || company.respond_to?(:new_record?) && company.new_record?
  return false if config.company.exclude_if.present? && config.company.exclude_if.call(company)
  company.present? && identity_present?
end