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("<h2>In config/dependencies.rb, make sure and include the 2 new dependencies: <\/h2>\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("<\/pre>\n");
document.write("			<\/td>\n");
document.write("		<td>\n");
document.write("		<pre class=\"textmate-source\"><pre class=\"sunburst\">\n");
document.write("dependency <span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;dm-is-paginated&quot;<\/span>, <span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;0.0.1&quot;<\/span>\n");
document.write("dependency <span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;merb-pagination&quot;<\/span>, <span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;0.0.1&quot;<\/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("<hr />\n");
document.write("<h2>In the model (app/models/post.rb) you want to page, you need to add is_paginated: <\/h2>\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("<\/pre>\n");
document.write("			<\/td>\n");
document.write("		<td>\n");
document.write("		<pre class=\"textmate-source\"><pre class=\"sunburst\">\n");
document.write("<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\'>Post<\/span><\/span>\n");
document.write("  <span class=\'keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby\'>include<\/span> <span class=\'support support_class support_class_ruby\'>DataMapper<\/span><span class=\'meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby\'>::<span class=\'entity entity_name entity_name_function entity_name_function_ruby\'>Resource<\/span><\/span>\n");
document.write("\n");
document.write("  is_paginated\n");
document.write("\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'>  # rest of model stuff...<\/span>\n");
document.write("<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("<hr />\n");
document.write("<h2>In your controller (app/controllers/posts.rb), page the results: <\/h2>\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("<\/pre>\n");
document.write("			<\/td>\n");
document.write("		<td>\n");
document.write("		<pre class=\"textmate-source\"><pre class=\"sunburst\">\n");
document.write("<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\'>Posts<span class=\'entity entity_other entity_other_inherited-class entity_other_inherited-class_ruby\'> &lt; Application<\/span><\/span><\/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\'>index<\/span><\/span>\n");
document.write("    <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@current_page<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby\'>=<\/span> (params[<span class=\'constant constant_other constant_other_symbol constant_other_symbol_ruby\'>:page<\/span>] <span class=\'keyword keyword_operator keyword_operator_logical keyword_operator_logical_ruby\'>||<\/span> <span class=\'constant constant_numeric constant_numeric_ruby\'>1<\/span>)<span class=\'meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby\'>.<span class=\'entity entity_name entity_name_function entity_name_function_ruby\'>to_i<\/span><\/span>\n");
document.write("    <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@page_count<\/span>, <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@posts<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby\'>=<\/span> <span class=\'support support_class support_class_ruby\'>Post<\/span><span class=\'meta meta_function-call meta_function-call_method meta_function-call_method_with-arguments meta_function-call_method_with-arguments_ruby\'>.<span class=\'entity entity_name entity_name_function entity_name_function_ruby\'>paginated<\/span><\/span>(\n");
document.write("      <span class=\'constant constant_other constant_other_symbol constant_other_symbol_ruby\'>:page<\/span> =&gt; <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@current_page<\/span>,\n");
document.write("      <span class=\'constant constant_other constant_other_symbol constant_other_symbol_ruby\'>:per_page<\/span> =&gt; <span class=\'constant constant_numeric constant_numeric_ruby\'>10<\/span>,\n");
document.write("      <span class=\'constant constant_other constant_other_symbol constant_other_symbol_ruby\'>:order<\/span> =&gt; [<span class=\'constant constant_other constant_other_symbol constant_other_symbol_ruby\'>:created_at<\/span><span class=\'meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby\'>.<span class=\'entity entity_name entity_name_function entity_name_function_ruby\'>desc<\/span><\/span>]\n");
document.write("    )\n");
document.write("\n");
document.write("    display <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@posts<\/span>\n");
document.write("  <span class=\'keyword keyword_control keyword_control_ruby\'>end<\/span>\n");
document.write("\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'>  # rest of controller stuff...<\/span>\n");
document.write("<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("<hr />\n");
document.write("<h2>Then in the view (app/views/posts/index.html.erb) : <\/h2>\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("<\/pre>\n");
document.write("			<\/td>\n");
document.write("		<td>\n");
document.write("		<pre class=\"textmate-source\"><pre class=\"sunburst\">\n");
document.write("<span class=\'keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby\'>&lt;<\/span><span class=\'keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby\'>%<\/span> <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@posts<\/span><span class=\'meta meta_function-call meta_function-call_method meta_function-call_method_without-arguments meta_function-call_method_without-arguments_ruby\'>.<span class=\'entity entity_name entity_name_function entity_name_function_ruby\'>each<\/span><\/span> <span class=\'keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block\'>do <\/span>|<span class=\'variable variable_other variable_other_block variable_other_block_ruby\'>post<\/span>| <span class=\'keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby\'>-<\/span><span class=\'string string_quoted string_quoted_other string_quoted_other_literal string_quoted_other_literal_other string_quoted_other_literal_other_ruby\'>%&gt;<\/span>\n");
document.write("<span class=\"String\">  Do your normal loop stuff here.<\/span>\n");
document.write("<span class=\"String\">&lt;% end -%&gt;<\/span>\n");
document.write("\n");
document.write("<span class=\'keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby\'>&lt;<\/span>!<span class=\'keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby\'>-<\/span><span class=\'keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby\'>-<\/span> <span class=\'keyword keyword_control keyword_control_ruby\'>then<\/span> add the pagination <span class=\'keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby\'>-<\/span><span class=\'keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby\'>-<\/span><span class=\'keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby\'>&gt;<\/span>\n");
document.write("\n");
document.write("    <span class=\'keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby\'>&lt;<\/span><span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_augmented keyword_operator_assignment_augmented_ruby\'>%=<\/span> <span class=\'meta meta_function-call meta_function-call_ruby\'><span class=\'entity entity_name entity_name_function entity_name_function_ruby\'>paginate<\/span><\/span>(\n");
document.write("      <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@current_page<\/span>, \n");
document.write("      <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@page_count<\/span>, \n");
document.write("      <span class=\'constant constant_other constant_other_symbol constant_other_symbol_ruby\'>:outer_window<\/span> =&gt; <span class=\'constant constant_numeric constant_numeric_ruby\'>5<\/span>, \n");
document.write("      <span class=\'constant constant_other constant_other_symbol constant_other_symbol_ruby\'>:next_label<\/span> =&gt; <span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;Older Posts &amp;raquo;&quot;<\/span>, \n");
document.write("      <span class=\'constant constant_other constant_other_symbol constant_other_symbol_ruby\'>:prev_label<\/span> =&gt; <span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;&amp;laquo; Newer Posts&quot;<\/span>\n");
document.write("      )\n");
document.write("    <span class=\'string string_quoted string_quoted_other string_quoted_other_literal string_quoted_other_literal_other string_quoted_other_literal_other_ruby\'>%&gt;<\/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/371098.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/371098\">Pastie #371098<\/a> linked directly from <a href=\"http://pastie.org/\">Pastie<\/a>.\n");
document.write("  <\/div><\/div>");
