Sha256: d29c33794d809272bd0405453ff530227252d1a10b58dd5f44318f50a3e6b622
Contents?: true
Size: 883 Bytes
Versions: 12
Compression:
Stored size: 883 Bytes
Contents
module IntercomRails module Proxy class Company < Proxy proxy_delegator :id, :identity => true proxy_delegator :name proxy_delegator :created_at config_delegator :plan config_delegator :monthly_spend 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 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 end end end
Version data entries
12 entries across 12 versions & 1 rubygems