Class: IntercomRails::Proxy::Company
- Defined in:
- lib/intercom-rails/proxy/company.rb
Instance Attribute Summary
Attributes inherited from Proxy
#proxied_object, #search_object
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Proxy
class_string, #custom_data, inherited, #initialize, #standard_data, #to_hash
Constructor Details
This class inherits a constructor from IntercomRails::Proxy::Proxy
Class Method Details
.current_in_context(search_object) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# 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 |
Instance Method Details
#valid? ⇒ Boolean
26 27 28 29 30 |
# 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 |