{"id":1359,"date":"2013-01-07T12:55:22","date_gmt":"2013-01-07T03:55:22","guid":{"rendered":"http:\/\/www.techscore.com\/blog\/?p=1359"},"modified":"2018-11-14T16:33:57","modified_gmt":"2018-11-14T07:33:57","slug":"rails%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e7%b4%b9%e4%bb%8b-%e3%83%9a%e3%83%bc%e3%82%b8%e3%83%b3%e3%82%b0%e3%82%92%e8%a1%8c%e3%81%86%e3%80%8ckaminari%e3%80%8d","status":"publish","type":"post","link":"https:\/\/www.techscore.com\/blog\/2013\/01\/07\/rails%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e7%b4%b9%e4%bb%8b-%e3%83%9a%e3%83%bc%e3%82%b8%e3%83%b3%e3%82%b0%e3%82%92%e8%a1%8c%e3%81%86%e3%80%8ckaminari%e3%80%8d\/","title":{"rendered":"Rails\u30e9\u30a4\u30d6\u30e9\u30ea\u7d39\u4ecb: \u30da\u30fc\u30b8\u30f3\u30b0\u3092\u884c\u3046\u300ckaminari\u300d"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001\u9234\u6728\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u4e00\u89a7\u753b\u9762\u306b\u300c<span style=\"text-decoration: underline;\">&lt;&lt;<\/span> | <span style=\"text-decoration: underline;\">&lt;<\/span> | <span style=\"text-decoration: underline;\">1<\/span> | <span style=\"text-decoration: underline;\">2<\/span> | <span style=\"text-decoration: underline;\">3<\/span> .. <span style=\"text-decoration: underline;\">10<\/span> | <span style=\"text-decoration: underline;\">11<\/span> | <span style=\"text-decoration: underline;\">12<\/span> ... <span style=\"text-decoration: underline;\">98<\/span> | <span style=\"text-decoration: underline;\">99<\/span> | <span style=\"text-decoration: underline;\">100<\/span> | <span style=\"text-decoration: underline;\">&gt;<\/span> | <span style=\"text-decoration: underline;\">&gt;&gt;<\/span>\u300d\u306e\u3088\u3046\u306a\u30ea\u30f3\u30af\u304c\u4ed8\u3044\u3066\u3044\u308b\u3053\u3068\u306f\u591a\u3044\u3067\u3059\u306d\u3002<\/p>\n<p>\u30da\u30fc\u30b8\u30f3\u30b0\u3001\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u3001\u30da\u30fc\u30b8\u30e3\u30fc\u3001\u30fb\u30fb\u30fb\u306a\u3069\u3068\u547c\u3073\u65b9\u306f\u8272\u3005\u3042\u308a\u307e\u3059\u304c\u3001\u3053\u3053\u3067\u306f\u300c\u30da\u30fc\u30b8\u30f3\u30b0\u300d\u3068\u547c\u3076\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u30da\u30fc\u30b8\u30f3\u30b0\u3092\u5b9f\u73fe\u3059\u308b\u30e9\u30a4\u30d6\u30e9\u30ea kaminari \u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>kaminari (<a href=\"https:\/\/github.com\/amatsuda\/kaminari\">https:\/\/github.com\/amatsuda\/kaminari<\/a>)<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>kaminari \u306e\u5c0e\u5165<\/h2>\n<p>Gemfile \u306b\u4ee5\u4e0b\u306e\u884c\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true\">gem 'kaminari'<\/pre>\n<p>bundle install \u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true\">bundle install<\/pre>\n<p>\u3053\u308c\u3067\u6e96\u5099\u306f\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n<p>kaminari \u3092\u5c0e\u5165\u3059\u308b\u3068\u3001\u30e2\u30c7\u30eb\u30af\u30e9\u30b9\u306b page \u3068\u3044\u3046\u30b9\u30b3\u30fc\u30d7\u304c\u5b9a\u7fa9\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u306f\u30da\u30fc\u30b8\u30f3\u30b0\u306b\u304a\u3051\u308b\u300c\u4f55\u30da\u30fc\u30b8\u76ee\u300d\u3092\u6307\u5b9a\u3059\u308b\u305f\u3081\u306e\u30b9\u30b3\u30fc\u30d7\u3067\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true\"># 3 \u30da\u30fc\u30b8\u76ee\u3092\u53d6\u5f97.\r\nUser.page(3)<\/pre>\n<p>\u307e\u305f\u3001per \u30e1\u30bd\u30c3\u30c9\u3067\u30da\u30fc\u30b8\u3042\u305f\u308a\u306e\u4ef6\u6570\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true\"># \u30da\u30fc\u30b8\u3042\u305f\u308a 10 \u4ef6\u3068\u3057\u3066 3 \u30da\u30fc\u30b8\u76ee\u3092\u53d6\u5f97.\r\nUser.page(3).per(10)<\/pre>\n<p>&nbsp;<\/p>\n<h2>\u30da\u30fc\u30b8\u30f3\u30b0\u3059\u308b<\/h2>\n<h3>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9<\/h3>\n<p>\u307e\u305a\u306f\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3092\u5b9f\u88c5\u3057\u307e\u3059\u3002<\/p>\n<p>page \u306e\u5f15\u6570\u3092\u56fa\u5b9a\u306b\u3057\u3066\u3082\u610f\u5473\u306f\u3042\u308a\u307e\u305b\u3093\u306e\u3067\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u6307\u5b9a\u3055\u308c\u305f\u30da\u30fc\u30b8\u756a\u53f7 ( params[:page] ) \u3092\u6307\u5b9a\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u30da\u30fc\u30b8\u3042\u305f\u308a\u306e\u4ef6\u6570\u306f 10 \u306e\u56fa\u5b9a\u3068\u3057\u307e\u3059\uff08\u753b\u9762\u4e0a\u3067\u6307\u5b9a\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u3082\u826f\u3044\u3067\u3057\u3087\u3046\uff09\u3002<\/p>\n<pre class=\"lang:ruby decode:true\">class UsersController &lt; ApplicationController\r\n\r\n  def index\r\n    @users = User.page(params[:page]).per(10).order(:id)\r\n  end\r\n\r\nend<\/pre>\n<h3>\u00a0View<\/h3>\n<p>View \u3067\u306f paginate \u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u3001\u30da\u30fc\u30b8\u30f3\u30b0\u7528\u306e\u30ea\u30f3\u30af\u3092\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true\">&lt;%= paginate(@users) %&gt;<\/pre>\n<p>\u753b\u9762\u4e0a\u3067\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30ea\u30f3\u30af\u304c\u8868\u793a\u3055\u308c\u307e\u3059\uff08\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u306f\u4f55\u3082\u52b9\u3044\u3066\u3044\u306a\u3044\u72b6\u614b\u306a\u306e\u3067\u30b7\u30f3\u30d7\u30eb\u306a\u898b\u305f\u76ee\u3067\u3059\uff09\u3002<\/p>\n<p><a href=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2012\/12\/kaminari.png\" rel=\"facebox\" rel=\"attachment wp-att-1440\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-1440\" alt=\"kaminari\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2012\/12\/kaminari.png\" width=\"208\" height=\"50\" \/><\/a><\/p>\n<p>\u4ee5\u4e0a\u304c kaminari \u3092\u7528\u3044\u3066\u30da\u30fc\u30b8\u30f3\u30b0\u3092\u5b9f\u73fe\u3059\u308b\u6700\u5c0f\u306e\u624b\u9806\u3067\u3059\u3002<\/p>\n<p>page_entries_info \u30e1\u30bd\u30c3\u30c9\u3067\u300c\u25cb\u4ef6\u304b\u3089\u25cb\u4ef6\u307e\u3067\u8868\u793a\u300d\u306e\u3088\u3046\u306a\u6587\u5b57\u5217\u3092\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true\">&lt;%= page_entries_info(@users) %&gt;<\/pre>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2012\/12\/kaminari-3.png\" rel=\"facebox\" rel=\"attachment wp-att-1448\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-1448\" alt=\"kaminari-3\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2012\/12\/kaminari-3.png\" width=\"324\" height=\"56\" srcset=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2012\/12\/kaminari-3.png 324w, https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2012\/12\/kaminari-3-300x51.png 300w\" sizes=\"(max-width: 324px) 100vw, 324px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u8a2d\u5b9a\u3092\u5909\u66f4\u3059\u308b<\/h2>\n<h3>\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3067\u306e\u6307\u5b9a<\/h3>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001kaminari \u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb ( config\/initializers\/kaminari_config.rb ) \u304c\u751f\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true\">rails generate kaminari:config<\/pre>\n<p>\u751f\u6210\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304f\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u304b\u3089\u5909\u66f4\u3057\u305f\u3044\u9805\u76ee\u306e\u8a2d\u5b9a\u3092\u4fee\u6b63\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true\">Kaminari.configure do |config|\r\n  # config.default_per_page = 25\r\n  # config.max_per_page = nil \r\n  # config.window = 4 \r\n  # config.outer_window = 0 \r\n  # config.left = 0 \r\n  # config.right = 0 \r\n  # config.page_method_name = :page\r\n  # config.param_name = :page\r\nend<\/pre>\n<p>\u5404\u8a2d\u5b9a\u9805\u76ee\u306e\u610f\u5473\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2012\/12\/kaminari-21.png\" rel=\"facebox\" rel=\"attachment wp-att-1447\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-1447\" alt=\"kaminari-2\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2012\/12\/kaminari-21.png\" width=\"571\" height=\"44\" srcset=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2012\/12\/kaminari-21.png 571w, https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2012\/12\/kaminari-21-300x23.png 300w\" sizes=\"(max-width: 571px) 100vw, 571px\" \/><\/a><\/p>\n<ul>\n<li>default_per_page<br \/>\n\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30da\u30fc\u30b8\u3042\u305f\u308a\u306e\u8868\u793a\u4ef6\u6570\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u306f 25\uff09\u3002<\/li>\n<li>max_per_page<br \/>\n\u30da\u30fc\u30b8\u3042\u305f\u308a\u306e\u8868\u793a\u4ef6\u6570\u306e\u6700\u5927\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u306f nil\u3001\u3064\u307e\u308a\u7121\u5236\u9650\uff09\u3002<\/li>\n<li>window<br \/>\n\u8868\u793a\u4e2d\u306e\u30da\u30fc\u30b8\u306e\u5de6\u53f3\u4f55\u30da\u30fc\u30b8\u5206\u306e\u30ea\u30f3\u30af\u3092\u8868\u793a\u3059\u308b\u304b\u3092\u6307\u5b9a\u3057\u307e\u3059\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u306f 4\uff09\u3002\u4e0a\u8a18\u753b\u50cf\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u306e 4 \u3067\u300111 \u30da\u30fc\u30b8\u3092\u8868\u793a\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u3067\u3059\u300211 \u306e\u5de6\u53f3\u305d\u308c\u305e\u308c 4 \u30da\u30fc\u30b8\u5206\u306e\u30ea\u30f3\u30af\u304c\u751f\u6210\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/li>\n<li>outer_window<br \/>\n\u5148\u982d\u30da\u30fc\u30b8\u3001\u53ca\u3073\u6700\u7d42\u30da\u30fc\u30b8\u304b\u3089\u4f55\u30da\u30fc\u30b8\u5206\u306e\u30ea\u30f3\u30af\u3092\u8868\u793a\u3059\u308b\u304b\u3092\u6307\u5b9a\u3057\u307e\u3059\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u306f 0\uff09\u3002left\u3001right \u304c\u6307\u5b9a\u3055\u308c\u305f\u5834\u5408\u306f\u3001\u305d\u3061\u3089\u306e\u5024\u304c\u512a\u5148\u3055\u308c\u307e\u3059\u3002<\/li>\n<li>left<br \/>\n\u5148\u982d\u30da\u30fc\u30b8\u304b\u3089\u4f55\u30da\u30fc\u30b8\u5206\u306e\u30ea\u30f3\u30af\u3092\u8868\u793a\u3059\u308b\u304b\u3092\u6307\u5b9a\u3057\u307e\u3059\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u306f 0\uff09\u3002\u4e0a\u8a18\u753b\u50cf\u306f 3 \u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u3067\u3059\u3002<\/li>\n<li>right\u6700\u7d42\u30da\u30fc\u30b8\u304b\u3089\u4f55\u30da\u30fc\u30b8\u5206\u306e\u30ea\u30f3\u30af\u3092\u8868\u793a\u3059\u308b\u304b\u3092\u6307\u5b9a\u3057\u307e\u3059\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u306f 0\uff09\u3002\u4e0a\u8a18\u753b\u50cf\u306f 2 \u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u3067\u3059\u3002<\/li>\n<li>page_method_name<br \/>\n\u30e2\u30c7\u30eb\u306b\u8ffd\u52a0\u3055\u308c\u308b\u30da\u30fc\u30b8\u756a\u53f7\u3092\u6307\u5b9a\u3059\u308b\u30b9\u30b3\u30fc\u30d7\u306e\u540d\u524d\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u306f page\uff09\u3002<\/li>\n<li>param_name<br \/>\n\u30da\u30fc\u30b8\u756a\u53f7\u3092\u6e21\u3059\u305f\u3081\u306b\u4f7f\u7528\u3059\u308b\u30ea\u30af\u30a8\u30b9\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u540d\u524d\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u306f page\uff09\u3002<\/li>\n<\/ul>\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u6307\u5b9a\u306f\u3001\u30e2\u30c7\u30eb\u3084 View \u3067\u4e0a\u66f8\u304d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>\u30e2\u30c7\u30eb\u3067\u306e\u6307\u5b9a<\/h3>\n<p>\u30e2\u30c7\u30eb\u30af\u30e9\u30b9\u3054\u3068\u306b\u30c7\u30d5\u30a9\u30eb\u30c8\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true\">class User &lt; ActiveRecord::Base\r\n\r\n  paginates_per 10\r\n  max_paginates_per 30\r\n\r\nend<\/pre>\n<h3>View \u3067\u306e\u6307\u5b9a<\/h3>\n<p>\u4e0a\u8a18\u8a2d\u5b9a\u306f View \u3067\u4f7f\u7528\u3059\u308b paginates \u30e1\u30bd\u30c3\u30c9\u3067\u500b\u5225\u306b\u6307\u5b9a\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true\">&lt;%= paginates(@user, :outer_window =&gt; 3) %&gt;<\/pre>\n<p>:params \u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u8ffd\u52a0\u306e URL \u30d1\u30e9\u30fc\u30e1\u30fc\u30bf\u306e\u5024\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true\">&lt;%= paginates(@user, :params =&gt; {:other_param =&gt; 'taro'}) %&gt;<\/pre>\n<p>&nbsp;<\/p>\n<h2>\u65e5\u672c\u8a9e\u5316<\/h2>\n<p>\u30ed\u30b1\u30fc\u30eb\u30d5\u30a1\u30a4\u30eb\u306e\u8a18\u8ff0\u4f8b\u3067\u3059\u3002<\/p>\n<pre class=\"lang:yaml decode:true\">ja:\r\n  views:\r\n    pagination:\r\n      first: \u5148\u982d\r\n      last: \u6700\u7d42\r\n      previous: \u524d\u30da\u30fc\u30b8\r\n      next: \u6b21\u30da\u30fc\u30b8\r\n      truncate: \"...\"\r\n  helpers:\r\n    page_entries_info:\r\n      one_page:\r\n        zero: \"<b>\u8a72\u5f53\u30c7\u30fc\u30bf\u304c\u3042\u308a\u307e\u305b\u3093\u3002<\/b>\"\r\n        one: \"<b>1\u4ef6\u4e2d&nbsp;1-1&nbsp;\u4ef6\u3092\u8868\u793a<\/b>\"\r\n        display_entries: '%{entry_name}\u306e1-%{count}\u4ef6\u3092\u8868\u793a\u4e2d \/ \u5408\u8a08%{count}\u4ef6'\r\n      more_pages:\r\n        display_entries: '%{entry_name}\u306e%{first}-%{last}\u4ef6\u3092\u8868\u793a\u4e2d \/ \u5408\u8a08%{total}\u4ef6'<\/pre>\n<p>\u203bhelpers. page_entries_info.more_pages.display_entries \u306e\u5024\u306e\u4e2d\u3067 entry_name \u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u8868\u793a\u3055\u308c\u308b\u6642\u306b\u300c\u30e6\u30fc\u30b6s\u300d\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u3001\u610f\u56f3\u901a\u308a\u306b\u8868\u793a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u30b3\u30fc\u30c9\u3092\u898b\u305f\u3068\u3053\u308d\u3001\u691c\u7d22\u7d50\u679c\u304c\u8907\u6570\u4ef6\u306e\u5834\u5408\u306f entry_name \u306e\u5024\u306b pluralize \u304c\u9069\u7528\u3055\u308c\u308b\uff08\u3064\u307e\u308a '\u30e6\u30fc\u30b6'.pluralize =&gt; '\u30e6\u30fc\u30b6s' \u3068\u306a\u308b\uff09\u3053\u3068\u304c\u539f\u56e0\u306e\u3088\u3046\u3067\u3057\u305f\uff08\u73fe\u6642\u70b9\u3067\uff09\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>View \u30d5\u30a1\u30a4\u30eb\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba<\/h2>\n<p>View \u30d5\u30a1\u30a4\u30eb\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u751f\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true\">&gt; rails generate kaminari:views default\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 create\u00a0 app\/views\/kaminari\/_page.html.erb\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 create\u00a0 app\/views\/kaminari\/_gap.html.erb\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 create\u00a0 app\/views\/kaminari\/_first_page.html.erb\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 create\u00a0 app\/views\/kaminari\/_paginator.html.erb\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 create\u00a0 app\/views\/kaminari\/_last_page.html.erb\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 create\u00a0 app\/views\/kaminari\/_prev_page.html.erb\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 create\u00a0 app\/views\/kaminari\/_next_page.html.erb<\/pre>\n<p>\u5f15\u6570\u306e\u300cdefault\u300d\u306f\u4f7f\u7528\u3059\u308b\u30c6\u30fc\u30de\u3067\u3059\u3002\u30c6\u30fc\u30de\u3092\u6307\u5b9a\u305b\u305a\u306b\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u4f7f\u7528\u53ef\u80fd\u306a\u30c6\u30fc\u30de\u4e00\u89a7\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true\"># \u6307\u5b9a\u53ef\u80fd\u306a\u30c6\u30fc\u30de\u3092\u78ba\u8a8d.\r\nrails generate kaminari:views<\/pre>\n<p>\u8907\u6570\u306e\u30c6\u30fc\u30de\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u751f\u6210\u3057\u305f\u5834\u5408\u306f\u3001paginate \u30e1\u30bd\u30c3\u30c9\u306e :theme \u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u4f7f\u7528\u3059\u308b\u30c6\u30fc\u30de\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true\">&lt;%= paginate(@users, :theme =&gt; 'admin') %&gt;<\/pre>\n<p>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306f HAML \u5f62\u5f0f\u3067\u751f\u6210\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true\">rails generate kaminari:views default -e haml<\/pre>\n<p>&nbsp;<\/p>\n<h2>\u00a0\u307e\u3068\u3081<\/h2>\n<p>Rails2.x \u6642\u4ee3\u306f will_paginate \u3068\u3044\u3046\u5927\u5909\u6709\u540d\u306a\u30d7\u30e9\u30b0\u30a4\u30f3\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u5f8c\u767a\u306e kaminari \u306f\u3001will_paginate \u3088\u308a\u30e2\u30c7\u30eb\u3092\u6c5a\u3055\u306a\u3044\u3001HTML5 \u306b\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u3001\u3068\u3044\u3046\u7406\u7531\u3067\u597d\u307e\u308c\u308b\u3053\u3068\u304c\u591a\u3044\u3068\u611f\u3058\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001\u9234\u6728\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u4e00\u89a7\u753b\u9762\u306b\u300c&lt;&lt; | &lt; | 1 | 2 | 3 .. 10 | 11 | 12 ... 98 | 99 | 100 | &gt; | &gt;&gt;\u300d\u306e\u3088\u3046\u306a\u30ea\u30f3\u30af\u304c\u4ed8\u3044\u3066\u3044\u308b\u3053\u3068\u306f\u591a\u3044\u3067\u3059\u306d\u3002<br \/><a href=\"https:\/\/www.techscore.com\/blog\/2013\/01\/07\/rails%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e7%b4%b9%e4%bb%8b-%e3%83%9a%e3%83%bc%e3%82%b8%e3%83%b3%e3%82%b0%e3%82%92%e8%a1%8c%e3%81%86%e3%80%8ckaminari%e3%80%8d\/\">\u7d9a\u304d\u3092\u8aad\u3080...<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[91,18,84],"tags":[22,24,70],"_links":{"self":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/1359"}],"collection":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/comments?post=1359"}],"version-history":[{"count":1,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/1359\/revisions"}],"predecessor-version":[{"id":17984,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/1359\/revisions\/17984"}],"wp:attachment":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/media?parent=1359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/categories?post=1359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/tags?post=1359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}