Sha256: 86dd6dce3da51c8c601979d9c0b15918974a5ec8ee152d708fd7a4023f28b6a5
Contents?: true
Size: 865 Bytes
Versions: 19
Compression:
Stored size: 865 Bytes
Contents
class TreeMenuNodeDef < ActiveRecord::Base attr_protected :created_at, :updated_at acts_as_nested_set include ErpTechSvcs::Utils::DefaultNestedSetMethods def refers_to_ar_class? return (self.resource_class != nil) end def find_parent_text parent_text = '' unless self.parent_id.nil? parent_text = self.parent.text end parent_text end def self.find_menu_roots( menu_short_name ) where("parent_id = nil and menu_short_name = menu_short_name") end def self.find_children(parent_id = nil) parent_id.to_i == 0 ? self.roots : find(parent_id).children end def leaf unknown? || children.size == 0 end def to_json_with_leaf(options = {}) self.to_json_without_leaf(options.merge(:methods => :leaf)) end alias_method_chain :to_json, :leaf end
Version data entries
19 entries across 19 versions & 1 rubygems