document.write("<div class=\"pastie\">\n");
document.write("  <link href=\"http://pastie.org/stylesheets/embed.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n");
document.write("  <link href=\"http://pastie.org/stylesheets/clean.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n");
document.write("  \n");
document.write("\n");
document.write("  \n");
document.write("  \n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("	\n");
document.write("	<div class=\"allcode\">\n");
document.write("		<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n");
document.write("		<tr>\n");
document.write("			<td>\n");
document.write("				\n");
document.write("				<pre class=\"textmate-source-numbers\">1\n");
document.write("2\n");
document.write("3\n");
document.write("4\n");
document.write("5\n");
document.write("6\n");
document.write("7\n");
document.write("8\n");
document.write("9\n");
document.write("10\n");
document.write("11\n");
document.write("12\n");
document.write("13\n");
document.write("14\n");
document.write("15\n");
document.write("16\n");
document.write("17\n");
document.write("18\n");
document.write("19\n");
document.write("20\n");
document.write("21\n");
document.write("22\n");
document.write("23\n");
document.write("24\n");
document.write("25\n");
document.write("26\n");
document.write("27\n");
document.write("28\n");
document.write("29\n");
document.write("30\n");
document.write("31\n");
document.write("32\n");
document.write("33\n");
document.write("34\n");
document.write("35\n");
document.write("36\n");
document.write("37\n");
document.write("38\n");
document.write("39\n");
document.write("40\n");
document.write("41\n");
document.write("42\n");
document.write("43\n");
document.write("44\n");
document.write("45\n");
document.write("<\/pre>\n");
document.write("			<\/td>\n");
document.write("		<td>\n");
document.write("		<pre class=\"textmate-source\"><pre class=\"sunburst\"><span class=\'meta meta_rails meta_rails_model\'><span class=\'meta meta_class meta_class_ruby\'><span class=\'keyword keyword_control keyword_control_class keyword_control_class_ruby\'>class<\/span> <span class=\'entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby\'>MenuItem<span class=\'entity entity_other entity_other_inherited-class entity_other_inherited-class_ruby\'> &lt; ActiveRecord::Base<\/span><\/span><\/span>\n");
document.write("<span class=\'support support_function support_function_activerecord support_function_activerecord_rails\'>belongs_to<\/span> <span class=\'constant constant_other constant_other_symbol constant_other_symbol_ruby\'>:menu<\/span>\n");
document.write("\n");
document.write("  <span class=\'meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby\'><span class=\'keyword keyword_control keyword_control_def keyword_control_def_ruby\'>def<\/span> <span class=\'entity entity_name entity_name_function entity_name_function_ruby\'>save<\/span>(<span class=\'variable variable_parameter variable_parameter_function variable_parameter_function_ruby\'>validate <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby\'>=<\/span> <span class=\'constant constant_language constant_language_ruby\'>true<\/span><\/span>)<\/span>\n");
document.write("    <span class=\'variable variable_language variable_language_ruby\'>self<\/span>.id <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby\'>=<\/span> <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_class variable_other_readwrite_class_ruby\'>@@menu_item<\/span>.length\n");
document.write("    <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_class variable_other_readwrite_class_ruby\'>@@menu_item<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_augmented keyword_operator_assignment_augmented_ruby\'>&lt;&lt;<\/span> <span class=\'variable variable_language variable_language_ruby\'>self<\/span>\n");
document.write("    <span class=\'support support_function support_function_activerecord support_function_activerecord_rails\'>validate<\/span> <span class=\'keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby\'>?<\/span> valid? : <span class=\'constant constant_language constant_language_ruby\'>true<\/span>\n");
document.write("  <span class=\'keyword keyword_control keyword_control_ruby\'>end<\/span>\n");
document.write("\n");
document.write("  <span class=\'meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby\'><span class=\'keyword keyword_control keyword_control_def keyword_control_def_ruby\'>def<\/span> <span class=\'entity entity_name entity_name_function entity_name_function_ruby\'>self.count<\/span>(<span class=\'variable variable_parameter variable_parameter_function variable_parameter_function_ruby\'><span class=\'keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby\'>*<\/span>args<\/span>)<\/span>\n");
document.write("    <span class=\'keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby\'>return<\/span>(<span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_class variable_other_readwrite_class_ruby\'>@@menu_item<\/span>.length)\n");
document.write("  <span class=\'keyword keyword_control keyword_control_ruby\'>end<\/span>\n");
document.write("\n");
document.write("  <span class=\'meta meta_function meta_function_method meta_function_method_without-arguments meta_function_method_without-arguments_ruby\'><span class=\'keyword keyword_control keyword_control_def keyword_control_def_ruby\'>def<\/span> <span class=\'entity entity_name entity_name_function entity_name_function_ruby\'>self.columns<\/span><\/span>\n");
document.write("    <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@columns<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_augmented keyword_operator_assignment_augmented_ruby\'>||=<\/span> []\n");
document.write("  <span class=\'keyword keyword_control keyword_control_ruby\'>end<\/span>\n");
document.write("\n");
document.write("  <span class=\'meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby\'><span class=\'keyword keyword_control keyword_control_def keyword_control_def_ruby\'>def<\/span> <span class=\'entity entity_name entity_name_function entity_name_function_ruby\'>self.column<\/span>(<span class=\'variable variable_parameter variable_parameter_function variable_parameter_function_ruby\'>name, sql_type <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby\'>=<\/span> <span class=\'constant constant_language constant_language_ruby\'>nil<\/span>, default <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby\'>=<\/span> <span class=\'constant constant_language constant_language_ruby\'>nil<\/span>, null <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby\'>=<\/span> <span class=\'constant constant_language constant_language_ruby\'>true<\/span><\/span>)<\/span>\n");
document.write("    columns <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_augmented keyword_operator_assignment_augmented_ruby\'>&lt;&lt;<\/span> <span class=\'support support_class support_class_ruby\'>ActiveRecord<\/span>::<span class=\'support support_class support_class_ruby\'>ConnectionAdapters<\/span>::<span class=\'support support_class support_class_ruby\'>Column<\/span>.<span class=\'keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby\'>new<\/span>(name.to_s, default, sql_type.to_s, null)\n");
document.write("  <span class=\'keyword keyword_control keyword_control_ruby\'>end<\/span>\n");
document.write("\n");
document.write("  <span class=\'meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby\'><span class=\'keyword keyword_control keyword_control_def keyword_control_def_ruby\'>def<\/span> <span class=\'entity entity_name entity_name_function entity_name_function_ruby\'>self.find<\/span>(<span class=\'variable variable_parameter variable_parameter_function variable_parameter_function_ruby\'><span class=\'keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby\'>*<\/span>args<\/span>)<\/span>\n");
document.write("    <span class=\'keyword keyword_control keyword_control_ruby\'>if<\/span> args.first.to_s <span class=\'keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby\'>==<\/span> <span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;all&quot;<\/span>\n");
document.write("      <span class=\'keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby\'>return<\/span> <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_class variable_other_readwrite_class_ruby\'>@@menu_item<\/span>\n");
document.write("    <span class=\'keyword keyword_control keyword_control_ruby\'>end<\/span>\n");
document.write("    <span class=\'keyword keyword_control keyword_control_ruby\'>if<\/span> args.first.class <span class=\'keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby\'>==<\/span> <span class=\'variable variable_other variable_other_constant variable_other_constant_ruby\'>Fixnum<\/span>\n");
document.write("      idx <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby\'>=<\/span> args.first\n");
document.write("      <span class=\'keyword keyword_control keyword_control_ruby\'>if<\/span> idx <span class=\'keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby\'>&lt;<\/span> <span class=\'constant constant_numeric constant_numeric_ruby\'>0<\/span>\n");
document.write("        <span class=\'keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby\'>return<\/span> <span class=\'constant constant_language constant_language_ruby\'>nil<\/span>\n");
document.write("      <span class=\'keyword keyword_control keyword_control_ruby\'>end<\/span>\n");
document.write("      <span class=\'keyword keyword_control keyword_control_ruby\'>if<\/span> idx <span class=\'keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby\'>&gt;=<\/span> <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_class variable_other_readwrite_class_ruby\'>@@menu_item<\/span>.size\n");
document.write("        <span class=\'keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby\'>return<\/span> <span class=\'constant constant_language constant_language_ruby\'>nil<\/span>\n");
document.write("      <span class=\'keyword keyword_control keyword_control_ruby\'>end<\/span>\n");
document.write("      <span class=\'keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby\'>return<\/span> <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_class variable_other_readwrite_class_ruby\'>@@menu_item<\/span>[idx]\n");
document.write("    <span class=\'keyword keyword_control keyword_control_ruby\'>end<\/span>\n");
document.write("  <span class=\'keyword keyword_control keyword_control_ruby\'>end<\/span>\n");
document.write("\n");
document.write("  column <span class=\'constant constant_other constant_other_symbol constant_other_symbol_ruby\'>:menu_id<\/span>,      <span class=\'constant constant_other constant_other_symbol constant_other_symbol_ruby\'>:integer<\/span>\n");
document.write("  column <span class=\'constant constant_other constant_other_symbol constant_other_symbol_ruby\'>:name<\/span>,    <span class=\'constant constant_other constant_other_symbol constant_other_symbol_ruby\'>:string<\/span>\n");
document.write("  column <span class=\'constant constant_other constant_other_symbol constant_other_symbol_ruby\'>:title<\/span>,  <span class=\'constant constant_other constant_other_symbol constant_other_symbol_ruby\'>:string<\/span>\n");
document.write("  column <span class=\'constant constant_other constant_other_symbol constant_other_symbol_ruby\'>:ctrl<\/span>,    <span class=\'constant constant_other constant_other_symbol constant_other_symbol_ruby\'>:string<\/span>\n");
document.write("\n");
document.write("  <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_class variable_other_readwrite_class_ruby\'>@@menu_item<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby\'>=<\/span> <span class=\'support support_class support_class_ruby\'>Array<\/span>.<span class=\'keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby\'>new<\/span>\n");
document.write("  <span class=\'support support_class support_class_ruby\'>Menu<\/span>.find(<span class=\'constant constant_other constant_other_symbol constant_other_symbol_ruby\'>:all<\/span>)\n");
document.write("<\/span><span class=\'keyword keyword_control keyword_control_ruby\'>end<\/span>\n");
document.write("<\/pre><\/pre>\n");
document.write("		<\/td>\n");
document.write("		<\/tr>\n");
document.write("		<\/table>\n");
document.write("	\n");
document.write("	<\/div>\n");
document.write("\n");
document.write("\n");
document.write("  \n");
document.write("  \n");
document.write("  <div class=\"credit\">\n");
document.write("    <div class=\"buttons\">\n");
document.write("      <a href=\"http://pastie.org/pastes/652341.txt\">\n");
document.write("      <img src=\"http://pastie.org/images/view.png\" height=\"20\" width=\"67\" /><\/a>\n");
document.write("    <\/div>\n");
document.write("  \n");
document.write("    <a href=\"http://pastie.org/652341\">Pastie #652341<\/a> linked directly from <a href=\"http://pastie.org/\">Pastie<\/a>.\n");
document.write("  <\/div><\/div>");
