Sha256: a4afd11858e5dba8a5ec805f5a82fe80e9ea1161b74c9e03d885e14977351ef2
Contents?: true
Size: 937 Bytes
Versions: 7
Compression:
Stored size: 937 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
7 entries across 7 versions & 1 rubygems