Sha256: f063505d2358b3ab7bda7866277f38b8ea7167449a83a6506edce46cb3971736
Contents?: true
Size: 970 Bytes
Versions: 4
Compression:
Stored size: 970 Bytes
Contents
module AbAdmin module Models module Structure extend ActiveSupport::Concern included do include AbAdmin::Concerns::Headerable include AbAdmin::Concerns::NestedSet enumerated_attribute :structure_type, :id_attribute => :kind enumerated_attribute :position_type, :id_attribute => :position validates_presence_of :title validates_numericality_of :position, :only_integer => true has_one :static_page, :dependent => :destroy has_many :visible_children, :class_name => name, :foreign_key => 'parent_id', :conditions => {:is_visible => true} scope :visible, where(:is_visible => true) scope :with_kind, proc {|structure_type| where(:kind => structure_type.id) } scope :with_position, proc {|position_type| where(:position => position_type.id).order('lft DESC') } end def redirect? kind == StructureType.redirect.id end end end end
Version data entries
4 entries across 4 versions & 1 rubygems