Sha256: 2d44d1a029ac2aa83f96f0e2a0144735b5abbd08ed37cc795cb6a7bea5db54c1

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

# encoding: utf-8
class MagicAddresses::Addressible < ActiveRecord::Base
  
  # =====> C O N S T A N T S <=============================================================== #
  PARAMS = [ :id, :owner_type, :owner_id, :_destroy, :address_attributes => [ :id, :street, :street_additional, :number, :postalcode, :city, :country, :country_code, :owner, :_destroy ] ]
  
  
  # =====> A S S O Z I A T I O N S <========================================================= #
  belongs_to :owner,      polymorphic: true
  belongs_to :address,    class_name: "MagicAddresses::Address",    foreign_key: :address_id
  
  
  # =====> C A L L B A C K S <=============================================================== #
  after_commit :log_some_stuff
  
  # =====>  P  R  I  V  A  T  E  !  <======================================================== # # # # # # # #
private
  
  def log_some_stuff
    Rails.logger.info "### ###"
    Rails.logger.info "### ###"
    Rails.logger.info "###  Triggered Addressible callback"
    Rails.logger.info "### ###"
    Rails.logger.info "### ###"
    puts "### ###"
    puts "### ###"
    puts "###  Triggered Addressible callback"
    puts "### ###"
    puts "### ###"
    self.address ? self.address.trigger_build_address_associations : true
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
magic_addresses-0.0.39.rc6 lib/app/models/magic_addresses/addressible.rb