Class: PipeLineDealer::Company

Inherits:
Model::Base show all
Includes:
CustomFields
Defined in:
lib/pipe_line_dealer/model/company.rb,
lib/pipe_line_dealer/model/company/custom_field.rb

Defined Under Namespace

Classes: CustomField

Constant Summary

Constants included from CustomFields

PipeLineDealer::CustomFields::CUSTOM_FIELD_PREFIX, PipeLineDealer::CustomFields::CUSTOM_FIELD_REGEX

Constants included from Model::Base::Concern::Persistance

Model::Base::Concern::Persistance::IGNORE_ATTRIBUTES_WHEN_SAVING

Instance Attribute Summary

Attributes inherited from Model::Base

#attributes, #id

Instance Method Summary collapse

Methods inherited from Model::Base

#==, #attributes_for_saving, attrs, inherited, #initialize, pld_attr, #to_json, #to_s

Methods included from Model::Base::Concern::Persistance

#destroy, #new_record?, #persisted?, #save

Constructor Details

This class inherits a constructor from PipeLineDealer::Model::Base

Instance Method Details

#attributes_for_saving_with_company(attributes) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/pipe_line_dealer/model/company.rb', line 18

def attributes_for_saving_with_company attributes
  attributes = attributes_for_saving_without_company(attributes)

  attributes.delete(:total_pipeline)
  attributes.delete(:won_deals)
  attributes.delete(:won_deals_total)
  attributes.delete(:image_thumb_url) if attributes[:image_thumb_url] == "/images/thumb/missing_company.png"

  attributes
end

#notesObject



31
32
33
34
35
# File 'lib/pipe_line_dealer/model/company.rb', line 31

def notes
  Collection.new(@collection.client, klass: Note, cached: false).\
    where(query: { company_id: self.id }).\
    on_new_defaults(company_id: self.id)
end