Module: BigbangEngine::Support::FundConcern::Callbacks

Extended by:
ActiveSupport::Concern
Defined in:
lib/bigbang_engine/support/concerns/fund_concern/callbacks.rb

Instance Method Summary collapse

Instance Method Details

#after_destroy_assetObject



33
34
35
# File 'lib/bigbang_engine/support/concerns/fund_concern/callbacks.rb', line 33

def after_destroy_asset
  set_status
end

#after_save_assetObject



29
30
31
# File 'lib/bigbang_engine/support/concerns/fund_concern/callbacks.rb', line 29

def after_save_asset
  set_status
end

#reject_attachmentsObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/bigbang_engine/support/concerns/fund_concern/callbacks.rb', line 18

def reject_attachments
  self.promotional_material = nil if promotional_material &&
    promotional_material.file_file_name.blank?
  self.regulation = nil if regulation && regulation.file_file_name.blank?
  self.sheet_complementary_form = nil if sheet_complementary_form && 
    sheet_complementary_form.file_file_name.blank?
  self.sheet_essential = nil if sheet_essential && 
    sheet_essential.file_file_name.blank?
  true
end

#set_statusObject



37
38
39
40
# File 'lib/bigbang_engine/support/concerns/fund_concern/callbacks.rb', line 37

def set_status
  manager.status = manager.balances.actives.empty? ? :inactive : :active
  manager.save!
end

#update_client_attributesObject



11
12
13
14
15
16
# File 'lib/bigbang_engine/support/concerns/fund_concern/callbacks.rb', line 11

def update_client_attributes
  if client
    client.update_attribute(:name, name) if name_changed?
    client.update_attribute(:document, cnpj) if cnpj_changed?
  end
end