Sha256: 0c4864422fb2014f23cc136f02402df3c285dbd360eee994f1fc2495f6a12fa7

Contents?: true

Size: 405 Bytes

Versions: 2

Compression:

Stored size: 405 Bytes

Contents

module MegaBar 
  class Layable < ActiveRecord::Base
    belongs_to :layout
    belongs_to :layout_section
    belongs_to :template_section

    after_destroy :delete_dependents

    def delete_dependents
     #only destroy layoutsections if no other layables use it.
     LayoutSection.destroy(self.layout_section_id) if Layable.where(layout_section_id: self.layout_section_id).blank?
    end
  end
end 

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mega_bar-0.5.2 app/models/mega_bar/layable.rb
mega_bar-0.5.1 app/models/mega_bar/layable.rb