Sha256: a6e00fc5b628b29f22bc7ea3f6ab7417ab6adf45f9f248d5a44fa74322d3d02e

Contents?: true

Size: 730 Bytes

Versions: 17

Compression:

Stored size: 730 Bytes

Contents

class DocumentedItem < ActiveRecord::Base
  attr_protected :created_at, :updated_at

  belongs_to :online_document_section
  
  def content
    if content?
      Content.find(documented_content_id)
    elsif klass?
      self.documented_klass
    end
  end
  
  def published_content(active_publication)
    if content?
      DocumentedContent.find_published_by_section(active_publication, online_document_section)
    elsif klass?
      self.documented_klass
    end
  end

  def klass?
    !!self.documented_klass
  end
  
  def content?
    !!self.documented_content_id
  end
  
  def self.find_by_section_id( website_section_id )
    DocumentedItem.where(["online_document_section_id = ?", website_section_id]).first
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
knitkit-3.0.0 app/models/documented_item.rb
knitkit-2.1.15 app/models/documented_item.rb
knitkit-2.1.14 app/models/documented_item.rb
knitkit-2.1.13 app/models/documented_item.rb
knitkit-2.1.12 app/models/documented_item.rb
knitkit-2.1.11 app/models/documented_item.rb
knitkit-2.1.10 app/models/documented_item.rb
knitkit-2.1.9 app/models/documented_item.rb
knitkit-2.1.8 app/models/documented_item.rb
knitkit-2.1.7 app/models/documented_item.rb
knitkit-2.1.6 app/models/documented_item.rb
knitkit-2.1.5 app/models/documented_item.rb
knitkit-2.1.4 app/models/documented_item.rb
knitkit-2.1.3 app/models/documented_item.rb
knitkit-2.1.2 app/models/documented_item.rb
knitkit-2.1.1 app/models/documented_item.rb
knitkit-2.1.0 app/models/documented_item.rb