Sha256: 3cc8f10584804c22f134ebdfe8ef6cca3f5a68998b5a166b8bb86c669feb7c99

Contents?: true

Size: 678 Bytes

Versions: 23

Compression:

Stored size: 678 Bytes

Contents

class Link < ActiveRecord::Base
  acts_as_content_block :connectable => false
  
  named_scope :named, lambda{|name| {:conditions => ['links.name = ?', name]}}
  
  has_one :section_node, :as => :node, :dependent => :destroy
  
  validates_presence_of :name

  def section_id
    section ? section.id : nil
  end
  
  def section
    section_node ? section_node.section : nil
  end
  
  def section_id=(sec_id)
    self.section = Section.find(sec_id)
  end
  
  def section=(sec)
    if section_node
      section_node.move_to_end(sec)
    else
      build_section_node(:node => self, :section => sec)
    end      
  end

  #needed by menu_helper
  def path
    url
  end

end

Version data entries

23 entries across 23 versions & 7 rubygems

Version Path
webficient-browsercms-3.0.2 app/models/link.rb
webficient-browsercms-3.0.3 app/models/link.rb
webficient-browsercms-3.0.4 app/models/link.rb
browsercms-3.1.4 app/models/link.rb
browsercms-3.1.3 app/models/link.rb
bf4-browsercms-3.1.0 app/models/link.rb
drujensen-browsercms-3.2.0 app/models/link.rb
browsercmsi-3.1.2 app/models/link.rb
browsercms-3.1.2 app/models/link.rb
browsercms-3.1.1 app/models/link.rb
browsercmsi-3.1.1 app/models/link.rb
browsercmsi-3.1.0 app/models/link.rb
browsercms-3.1.0 app/models/link.rb
we5-browsercms-3.1.0 app/models/link.rb
browsercms-3.0.6 app/models/link.rb
browsercms-3.0.5 app/models/link.rb
we5-browsercms-3.0.5.1 app/models/link.rb
we5-browsercms-3.0.5 app/models/link.rb
browsercms_s3-3.0.5 app/models/link.rb
browsercms-3.0.4 app/models/link.rb