class DynamicMenu < ActiveRecord::Base attr_accessible :title, :dynamic_menu_id, :url, :idstr, :sort, :check_callbacks translates :title has_many :dynamic_menus validate :validate def validate self.dynamic_menu_id = 0 if self.dynamic_menu_id.to_i == 0 end def title! title_str = title return "[#{_("no title")}]" if title_str.to_s.strip.empty? return title_str end def check_callbacks_enum Enumerator.new do |yielder| self.check_callbacks.to_s.strip.split(/\s*,\s*/).each do |str| yielder << str.to_s.strip.to_sym unless str.empty? end end end def check_callbacks? !check_callbacks.to_s.strip.empty? end end