Sha256: 8cc873bcce988c83317824e9174662b41ac3759af436702113db8640f15a7b56
Contents?: true
Size: 800 Bytes
Versions: 5
Compression:
Stored size: 800 Bytes
Contents
class SimpleContentManagement::SimpleMenuItem < ActiveRecord::Base belongs_to :parent, class_name: "SimpleContentManagement::SimpleMenuItem" has_many :children, class_name: "SimpleContentManagement::SimpleMenuItem", foreign_key: "parent_id" validates_presence_of :name, :uri, :method, :simple_menu_id validates_inclusion_of :is_target_blank, in: [ true, false ] validates_inclusion_of :method, in: %(get post put delete) attr_accessible :name, :uri, :is_target_blank, :position, :simple_menu_id, :parent_id, :method scope :ordered, order("position") def simple_menu SimpleContentManagement::SimpleMenu.find simple_menu_id end def parents parents = [] parent = self while parent.parent.present? parents << parent.parent parent = self.parent end return parents end end
Version data entries
5 entries across 5 versions & 1 rubygems