Sha256: f600a03620faf307b923cc6f18f42a997183b90304d7563ae267e45fcea5b29c

Contents?: true

Size: 655 Bytes

Versions: 11

Compression:

Stored size: 655 Bytes

Contents

class Link < ActiveRecord::Base
  acts_as_content_block
  
  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

11 entries across 11 versions & 7 rubygems

Version Path
SFEley-browsercms-3.0.2 app/models/link.rb
buzzware-browsercms-3.0.2 app/models/link.rb
coredumplings-browsercms-3.0.0 app/models/link.rb
nate-browsercms-3.0.210 app/models/link.rb
nate-browsercms-3.0.211 app/models/link.rb
we5-browsercms-3.0.1.1 app/models/link.rb
webficient-browsercms-3.0.1 app/models/link.rb
we5-browsercms-3.0.2 app/models/link.rb
browsercms-3.0.2 app/models/link.rb
browsercms-3.0.1 app/models/link.rb
browsercms-3.0.0 app/models/link.rb