{"id":63786,"date":"2021-08-01T08:08:09","date_gmt":"1970-01-01T00:00:00","guid":{"rendered":"https:\/\/www.sejuku.net\/blog\/?p=63786"},"modified":"2024-05-06T11:49:40","modified_gmt":"2024-05-06T02:49:40","slug":"%e3%80%90rails%e5%85%a5%e9%96%80%e3%80%91view%e3%81%a8model%e3%81%ae%e9%96%93%e3%81%abdecorator%ef%bc%88draper%ef%bc%89%e3%82%92%e7%bd%ae%e3%81%8f","status":"publish","type":"post","link":"https:\/\/www.sejuku.net\/blog\/63786","title":{"rendered":"\u3010Rails\u5165\u9580\u3011View\u3068Model\u306e\u9593\u306bDecorator\uff08Draper\uff09\u3092\u7f6e\u304f"},"content":{"rendered":"<p>\u4eca\u56de\u306f\u3001<span style=\"color: #54a870;\"><strong>Ruby on Rails<\/strong><\/span>\uff08\u4ee5\u964d\u3001<span style=\"color: #54a870;\"><strong>Rails<\/strong><\/span>\uff09\u3067\u3001\u8ab0\u3082\u304c\u982d\u3092\u60a9\u307e\u305b\u3066\u3044\u308b\u3001\u3042\u308b\u554f\u984c\u30921\u3064\u89e3\u6c7a\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u305d\u308c\u306f\u3001<\/p>\n<p><span style=\"color: #f75959;\"><strong>\u30fbModel\u3068View\u306e\u3069\u3063\u3061\u306b\u66f8\u304f\u306e\u554f\u984c<\/strong><\/span><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u975e\u5e38\u306b\u7c21\u5358\u306a\u4f8b\u3067\u3001<span style=\"color: #54a870;\"><strong>Model<\/strong><\/span>\u3067\u306f\u65e5\u6642\u3092\u201d2018-07-12 18:12:34\u201d\u3067\u4fdd\u6301\u3057\u3066\u3044\u307e\u3059\u304c\u3001<span style=\"color: #54a870;\"><strong>View<\/strong><\/span>\u3067\u306f\u201d2018\/7\/12\u201d\u3068\u8868\u793a\u3059\u308b\u5834\u5408\u3092\u8003\u3048\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u3053\u306e\u65e5\u6642\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u5909\u66f4\u3059\u308b\u30b3\u30fc\u30c9\u306f\u3001<span style=\"color: #54a870;\"><strong>Model<\/strong><\/span>\u3068<span style=\"color: #54a870;\"><strong>View<\/strong><\/span>\u306e\u3069\u3063\u3061\u306b\u66f8\u304f\u306e\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u79c1\u306f\u3001Model\u3068View\u306e\u9593\u306b<span style=\"color: #254df2;\"><strong>Decorator<\/strong><\/span>\u30921\u3064\u8ffd\u52a0\u3057\u3066\u3001Decorator\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\uff01<\/p>\n<p><span style=\"color: #f75959;\"><strong>\u3069\u3046\u3044\u3046\u3053\u3068\uff1f<\/strong><\/span>\u3068\u601d\u3063\u305f\u3042\u306a\u305f\u306f\u3001\u3053\u306e\u8a18\u4e8b\u3092\u8aad\u3080\u3079\u304d\u3067\u3059\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\u3001\u59cb\u3081\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>Decorator\u3068\u306f<\/h2>\n<p>\u3061\u3087\u3063\u3068\u6982\u5ff5\u7684\u306a\u8a71\u304b\u3089\u59cb\u3081\u307e\u3059\u306e\u3067\u3001\u307e\u305a\u306f\u7d50\u8ad6\u304b\u3089\u3002<\/p>\n<p>Model\u2192View\u306e\u95a2\u4fc2\u3067\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3044\u305f\u3068\u3053\u308d\u306bDecorator\u3092\u8ffd\u52a0\u3057\u3066\u3001Model\u2192<span style=\"color: #254df2;\"><strong>Decorator<\/strong><\/span>\u2192View\u306e\u95a2\u4fc2\u3067\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u3053\u3067\u306f\u3001\u300cDecorator\u3092\u8ffd\u52a0\u3059\u308b\u300d\u3068\u3001\u3069\u3046\u3057\u3066\u300c<span style=\"color: #f75959;\"><strong>Model\u3068View\u306e\u3069\u3063\u3061\u306b\u66f8\u304f\u306e\u554f\u984c<\/strong><\/span>\u300d\u304c\u89e3\u6c7a\u3067\u304d\u308b\u306e\u304b\u3092\u3001\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<p>\u79c1\u304c\u66f8\u304f\u8a18\u4e8b\u3067\u305f\u3073\u305f\u3073\u767b\u5834\u3057\u3066\u3044\u308b\u4ee5\u4e0b\u306e\u8868\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n\n<table id=\"tablepress-562\" class=\"tablepress tablepress-id-562\">\n<thead>\n<tr class=\"row-1\">\n\t<th class=\"column-1\">\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\uff08\u69cb\u6210\u8981\u7d20\uff09<\/th><th class=\"column-2\">\u8aac\u660e<\/th><th class=\"column-3\">\u5099\u8003<\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">Model\uff08\u30e2\u30c7\u30eb\uff09<\/td><td class=\"column-2\">\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u53d6\u308a\u6271\u3046<\/td><td class=\"column-3\">\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3078\u306e\u683c\u7d0d\u65b9\u6cd5\u306f\u3001Model\u306b\u96a0\u307a\u3044\u3059\u308b<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">View\uff08\u30d3\u30e5\u30fc\uff09<\/td><td class=\"column-2\">\u753b\u9762\u8868\u793a\u3092\u53d6\u308a\u6271\u3046<\/td><td class=\"column-3\">\u8868\u793a\u65b9\u6cd5\u306f\u3001View\u306b\u96a0\u307a\u3044\u3059\u308b<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\">Controller\uff08\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\uff09<\/td><td class=\"column-2\">\uff08\u30e6\u30fc\u30b6\u30fc\u306e\u5165\u529b\u3092\u53d7\u3051\u3066\uff09Model\u3068View\u306b\u30a2\u30ec\u30b3\u30ec\u6307\u793a\u3059\u308b<\/td><td class=\"column-3\">\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3078\u306e\u683c\u7d0d\u65b9\u6cd5\u3084\u8868\u793a\u65b9\u6cd5\u306f\u77e5\u3089\u306a\u3044<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-562 from cache -->\n<p>\u3053\u308c\u3092\u898b\u308b\u3068\u3001\u65e5\u6642\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u5909\u66f4\u3059\u308b\u30b3\u30fc\u30c9\u306f\u3001<span style=\"color: #f75959;\"><strong>Model\u306b\u3082View\u306b\u3082\u66f8\u3051\u308b\u6c17\u304c\u3057\u307e\u3059\u3002<\/strong><\/span><\/p>\n<p>Model\u3092\u898b\u308b\u3068\u300c\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3078\u306e\u683c\u7d0d\u65b9\u6cd5\u306f\u3001Model\u306b\u96a0\u307a\u3044\u3059\u308b\u300d\u3068\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u683c\u7d0d\u3059\u308b\u201d2018-07-12 18:12:34\u201d\u3068\u3044\u3046\u5f62\u5f0f\u306f\u3001View\u306b\u306f\u77e5\u3089\u308c\u305f\u304f\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u304b\u3089\u3001View\u3067\u65e5\u4ed8\u304c\u5fc5\u8981\u306b\u306a\u3063\u305f\u3089<span style=\"color: #254df2;\"><strong>Model\u5074\u3067\u9069\u5207\u306a\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306b\u3059\u308b\u3079\u304d<\/strong><\/span>\u3068\u3044\u3046\u8003\u3048\u65b9\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4e00\u65b9\u3001View\u3092\u898b\u308b\u3068\u300c\u8868\u793a\u65b9\u6cd5\u306f\u3001View\u306b\u96a0\u307a\u3044\u3059\u308b\u300d\u3068\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><span style=\"color: #254df2;\"><strong>\u201d2018\/7\/12\u201d\u3068\u3044\u3046\u8868\u793a\u65b9\u6cd5\u306fView\u5074\u306b\u66f8\u304f\u3079\u304d<\/strong><\/span>\u3068\u3082\u8003\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n<p>\u3069\u3061\u3089\u3082\u6b63\u3057\u3044\u6c17\u3082\u3057\u307e\u3059\u304c\u3001\u3069\u3061\u3089\u3082\u6b63\u3057\u304f\u306a\u3044\u6c17\u304c\u3057\u307e\u3059\u3002<\/p>\n<p>\u307e\u3055\u306b\u3001\u982d\u3092\u60a9\u307e\u305b\u308b<span style=\"color: #f75959;\"><strong>Model\u3068View\u306e\u3069\u3063\u3061\u306b\u66f8\u304f\u306e\u554f\u984c<\/strong><\/span>\u3067\u3059\u306d\u3002<\/p>\n<p>\u79c1\u306f\u3001<span style=\"color: #254df2;\"><strong>Decorator<\/strong><\/span>\u3092\u304a\u3059\u3059\u3081\u3059\u308b\u7acb\u5834\u3067\u3059\u306e\u3067\u3001\u6b21\u306e\u3088\u3046\u306b\u8003\u3048\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>Model\u306f\u300c<span style=\"color: #254df2;\"><strong>\u30c7\u30fc\u30bf<\/strong><\/span>\u7ba1\u7406\u3060\u3051\u300d\u3092\u62c5\u5f53\u3057\u3001View\u306f\u300c<span style=\"color: #f75959;\"><strong>\u60c5\u5831<\/strong><\/span>\u8868\u793a\u3060\u3051\u300d\u3092\u62c5\u5f53\u3059\u308b\u3001\u3068\u3044\u3046\u5f79\u5272\u5206\u62c5\u3067\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u65b0\u3057\u304f\u767b\u5834\u3059\u308bDecorator\u306b\u306f\u3001\u300c\uff08\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u7ba1\u7406\u3057\u3084\u3059\u3044\uff09<span style=\"color: #254df2;\"><strong>\u30c7\u30fc\u30bf<\/strong><\/span>\u300d\u3092\u300c\uff08\u30e6\u30fc\u30b6\u30fc\u304c\u7406\u89e3\u3057\u3084\u3059\u3044\uff09<span style=\"color: #f75959;\"><strong>\u60c5\u5831<\/strong><\/span>\u300d\u306b\u5909\u63db\u3059\u308b\u5f79\u5272\u3092\u6301\u305f\u305b\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u5148\u307b\u3069\u306e\u65e5\u6642\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u5909\u66f4\u3059\u308b\u30b3\u30fc\u30c9\u306fDecorator\u306b\u66f8\u304d\u3001View\u3067\u306fDecorator\u3067\u7528\u610f\u3057\u305f\u30e1\u30bd\u30c3\u30c9\u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>Model\u3068View\u306e\u9593\u306bDecorator\u3092\u8ffd\u52a0\u3057\u3066\u3001\u30c7\u30fc\u30bf\u3092\u60c5\u5831\u306b\u5909\u63db\u3059\u308b\u5f79\u5272\u3092\u6301\u305f\u305b\u308c\u3070\u3001<span style=\"color: #f75959;\"><strong>Model\u3068View\u306e\u3069\u3063\u3061\u306b\u66f8\u304f\u306e\u554f\u984c<\/strong><\/span>\u300d\u304c\u89e3\u6c7a\u3067\u304d\u305d\u3046\u3067\u3059\u306d\uff01<\/p>\n<h2>Draper\u3068\u306f<\/h2>\n<p>\u3053\u3053\u304b\u3089\u306f\u3001Rails\u3067Decorator\u3092\u5b9f\u73fe\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001Rails\u3089\u3057\u304fgem\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3001Decorator\u3092\u5b9f\u73fe\u3057\u307e\u3059\u3002<\/p>\n<p>Decorator\u3092\u7c21\u5358\u306b\u5c0e\u5165\u3059\u308b\u305f\u3081\u306egem\u306f\u3044\u304f\u3064\u304b\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>The Ruby Toolbox\u3067\u306f\u3001\u300cRails Presenters\u300d\u3068\u3044\u3046\u30ab\u30c6\u30b4\u30ea\u30fc\u3067\u96c6\u7d04\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator01.png\" alt=\"\" width=\"1388\" height=\"794\" class=\"alignnone size-full wp-image-63796\" srcset=\"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator01.png 1388w, https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator01-150x86.png 150w, https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator01-300x172.png 300w, https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator01-640x366.png 640w, https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator01-810x463.png 810w, https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator01-1140x652.png 1140w\" sizes=\"(max-width: 1388px) 100vw, 1388px\" \/><\/p>\n<p>\u53c2\u8003\uff1a<a href=\"https:\/\/www.ruby-toolbox.com\/categories\/rails_presenters\" target=\"_blank\" rel=\"noopener\">https:\/\/www.ruby-toolbox.com\/categories\/rails_presenters<\/a><\/p>\n<p>\u4eca\u56de\u306f\u3001\u6700\u3082\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u6570\u304c\u591a\u3044<span style=\"color: #54a870;\"><strong>Draper<\/strong><\/span>\u3092\u4f7f\u3063\u3066Decorator\u3092\u5c0e\u5165\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>Draper\u4ee5\u5916\u306b\u3082\u3001<span style=\"color: #54a870;\"><strong>Cells<\/strong><\/span>\u3001<span style=\"color: #54a870;\"><strong>ActiveDecorator<\/strong><\/span>\u3001<span style=\"color: #54a870;\"><strong>Apotomo<\/strong><\/span>\u3001<span style=\"color: #54a870;\"><strong>display_case<\/strong><\/span>\u306a\u3069\u304c\u767b\u9332\u3055\u308c\u3066\u3044\u307e\u3059\u306d\u3002<\/p>\n<p>\u5b9f\u88c5\u65b9\u6cd5\u3084\u4f7f\u3044\u304b\u305f\u304c\u7570\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u6700\u9ad8\u306egem\u3092\u63a2\u3059\uff01\u3068\u3044\u3046\u65b9\u306f\u8a66\u3057\u3066\u307f\u308b\u3068\u826f\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<h2>\u52d5\u4f5c\u3092\u7406\u89e3\u3059\u308b\u305f\u3081\u306eWeb\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3059\u308b<\/h2>\n<p>Draper\u306b\u3088\u308bDecorator\u3092\u7406\u89e3\u3059\u308b\u305f\u3081\u306b\u3001Rails\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066Web\u30a2\u30d7\u30ea\u3092\u4f5c\u308a\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\uff081\uff09<span style=\"color: #339966;\"><strong>Rails<\/strong><\/span>\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<p>\u79c1\u306f\u3001\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3092\u53c2\u8003\u306b\u3001VirtualBox\u3067\u4f5c\u6210\u3057\u305f\u4eee\u60f3\u30d1\u30bd\u30b3\u30f3\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305fLinux Mint\u306b\u3001Rails\u306e\u958b\u767a\u74b0\u5883\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u57fa\u672c\u7684\u306b\u306f\u8a18\u4e8b\u306e\u624b\u9806\u306b\u5f93\u3063\u3066\u64cd\u4f5c\u3057\u307e\u3059\u304c\u3001app\/samurai\/sample1\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3059\u308b\u4ee3\u308f\u308a\u306b\u3001<span style=\"color: #54a870;\"><strong>app\/samurai\/decorator-demo\u30c7\u30a3\u30ec\u30af\u30c8\u30ea<\/strong><\/span>\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>Rails\u3092\u8d77\u52d5\u3057\u3066\u3001\u30d6\u30e9\u30a6\u30b6\u3067\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u305f\u3089\u3001\u3044\u3063\u305f\u3093Rails\u3092\u7d42\u4e86\u3057\u3066\u304b\u3089\u6b21\u306b\u9032\u307f\u307e\u3059\u3002<\/p>\n            <a href=\"https:\/\/www.sejuku.net\/blog\/39936\" class=\"blog-card-anchor\">\n                <div class=\"blog-card\">\n                <div class=\"blog-card-content\">\n                    <div class=\"blog-card-thumbnail\">\n                    <img decoding=\"async\" class=\"blog-card-thumbnail-img\" src=\"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2017\/12\/ruby_on_rails-150x86.jpg\">\n                    <\/div>\n                    <div class=\"blog-card-title-wrap\">\n                    <div class=\"blog-card-title\">\u521d\u5fc3\u8005\u3067\u3082\u304b\u3093\u305f\u3093\uff01Ruby on Rails \u306e\u958b\u767a\u74b0\u5883\u306e\u69cb\u7bc9\u624b\u9806\uff08Mac\/Windows \u4e21\u5bfe\u5fdc\uff09<\/div>\n                    <div class=\"blog-card-update-date\">\u66f4\u65b0\u65e5\uff1a2024\u5e745\u67086\u65e5<\/div>\n                    <\/div>\n                <\/div>\n                <\/div>\n            <\/a>\n            \n<p>Linux Mint\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306b\u3064\u3044\u3066\u306f\u3001\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3067\u8a73\u3057\u304f\u8aac\u660e\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n            <a href=\"https:\/\/www.sejuku.net\/blog\/56765\" class=\"blog-card-anchor\">\n                <div class=\"blog-card\">\n                <div class=\"blog-card-content\">\n                    <div class=\"blog-card-thumbnail\">\n                    <img decoding=\"async\" class=\"blog-card-thumbnail-img\" src=\"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/06\/linux-mint-150x86.jpg\">\n                    <\/div>\n                    <div class=\"blog-card-title-wrap\">\n                    <div class=\"blog-card-title\">Linux Mint Cinnamon\u30a8\u30c7\u30a3\u30b7\u30e7\u30f3\u3092\u4f7f\u3063\u3066\u307f\u3088\u3046<\/div>\n                    <div class=\"blog-card-update-date\">\u66f4\u65b0\u65e5\uff1a2024\u5e745\u67086\u65e5<\/div>\n                    <\/div>\n                <\/div>\n                <\/div>\n            <\/a>\n            \n<h2>Draper\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h2>\n<p>Rails\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u6e08\u3093\u3067\u3044\u308c\u3070\u3001Draper\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u7c21\u5358\u3067\u3059\u3002<\/p>\n<p>\uff081\uff09Gemfile\u306e\u6700\u7d42\u884c\u306b\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"decode:true \" >gem 'draper'<\/pre>\n<p>\uff082\uff09\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u30921\u884c\u305a\u3064\u9806\u756a\u306b\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"decode:true \" >bundle install<\/pre>\n<p>Draper\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<h2>\u7c21\u5358\u306aDecorator\u3092\u4f7f\u3063\u3066\u307f\u308b<\/h2>\n<p>\u7c21\u5358\u306a\u4f8b\u3067\u3059\u304c\u3001<span style=\"color: #54a870;\"><strong>Model<\/strong><\/span>\u3067\u4fdd\u6301\u3057\u3066\u3044\u308b\u201d2018-07-12 18:12:34\u201d\u3068\u3044\u3046\u65e5\u6642\u3092\u3001<span style=\"color: #54a870;\"><strong>View<\/strong><\/span>\u3067\u306f\u201d2018\/7\/12\u201d\u3068\u8868\u793a\u3059\u308bDecorator\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u306f\u3001bin\/rails generate scaffold\u30b3\u30de\u30f3\u30c9\u3067\u3059\u3002<\/p>\n<p>\uff081\uff09<span style=\"color: #339966;\"><strong>\u300c\u7aef\u672b\u300d<\/strong><\/span>\u3067\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u30921\u884c\u305a\u3064\u9806\u756a\u306b\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true \">bin\/rails generate scaffold User name:string<\/pre>\n<p>\u5b9f\u884c\u7d50\u679c\uff1a<\/p>\n<pre class=\"striped:false marking:false ranges:false nums:false nums-toggle:false lang:default decode:true \" >Running via Spring preloader in process 20314\r\n      invoke  active_record\r\n      create    db\/migrate\/20180713061008_create_users.rb\r\n      create    app\/models\/user.rb\r\n      invoke    test_unit\r\n      create      test\/models\/user_test.rb\r\n      create      test\/fixtures\/users.yml\r\n      invoke  resource_route\r\n       route    resources :users\r\n      invoke  scaffold_controller\r\n      create    app\/controllers\/users_controller.rb\r\n      invoke    erb\r\n      create      app\/views\/users\r\n      create      app\/views\/users\/index.html.erb\r\n      create      app\/views\/users\/edit.html.erb\r\n      create      app\/views\/users\/show.html.erb\r\n      create      app\/views\/users\/new.html.erb\r\n      create      app\/views\/users\/_form.html.erb\r\n      invoke    test_unit\r\n      create      test\/controllers\/users_controller_test.rb\r\n      invoke    helper\r\n      create      app\/helpers\/users_helper.rb\r\n      invoke      test_unit\r\n      invoke    decorator\r\n      create      app\/decorators\/user_decorator.rb\r\n      invoke      test_unit\r\n      create        test\/decorators\/user_decorator_test.rb\r\n      invoke    jbuilder\r\n      create      app\/views\/users\/index.json.jbuilder\r\n      create      app\/views\/users\/show.json.jbuilder\r\n      create      app\/views\/users\/_user.json.jbuilder\r\n      invoke  test_unit\r\n      create    test\/system\/users_test.rb\r\n      invoke  assets\r\n      invoke    coffee\r\n      create      app\/assets\/javascripts\/users.coffee\r\n      invoke    scss\r\n      create      app\/assets\/stylesheets\/users.scss\r\n      invoke  scss\r\n      create    app\/assets\/stylesheets\/scaffolds.scss<\/pre>\n<p>\u901a\u5e38\u306escaffold\u3067\u4f5c\u6210\u3055\u308c\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\uff0f\u30d5\u30a1\u30a4\u30eb\u306b\u52a0\u3048\u3066\u3001\u4ee5\u4e0b\u306e4\u3064\u304c\u4f5c\u6210\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"striped:false marking:false ranges:false nums:false nums-toggle:false lang:default decode:true \" >      invoke    decorator\r\n      create      app\/decorators\/user_decorator.rb\r\n      invoke      test_unit\r\n      create        test\/decorators\/user_decorator_test.rb<\/pre>\n<p>Decorator\u3089\u3057\u3044\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3068\u30d5\u30a1\u30a4\u30eb\u3067\u3059\u306d\u3002<\/p>\n<p>\uff082\uff09\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u30921\u884c\u305a\u3064\u9806\u756a\u306b\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"decode:true \" >bin\/rails db:migrate\r\nbin\/rails console<\/pre>\n<p>\uff083\uff09\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"decode:true \" >User.create(name:\"\u5c71\u7530\u592a\u90ce\")\r\nUser.create(name:\"\u9577\u702c\u6765\")\r\nUser.create(name:\"\u7acb\u5ddd\u88d5\u7f8e\")\r\nUser.create(name:\"\u524d\u7530\u9054\u90ce\")\r\nUser.create(name:\"\u7d30\u5ddd\u4fee\u4e8c\")\r\nUser.create(name:\"\u6728\u6751\u62d3\u78e8\")\r\nexit<\/pre>\n<p>\uff084\uff09<span style=\"color: #54a870;\"><strong>app\/views\/users\/index.html.erb<\/strong><\/span>\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p>\u5909\u66f4\u524d\uff1a<\/p>\n<pre class=\"decode:true \" ><p id=\"notice\"><%= notice %><\/p>\r\n\r\n<h1>Users<\/h1>\r\n\r\n<table>\r\n  <thead>\r\n    <tr>\r\n      <th>Name<\/th>\r\n      <th colspan=\"3\"><\/th>\r\n    <\/tr>\r\n  <\/thead>\r\n\r\n  <tbody>\r\n    <% @users.each do |user| %>\r\n      <tr>\r\n        <td><%= user.name %><\/td>\r\n        <td><%= link_to 'Show', user %><\/td>\r\n        <td><%= link_to 'Edit', edit_user_path(user) %><\/td>\r\n        <td><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %><\/td>\r\n      <\/tr>\r\n    <% end %>\r\n  <\/tbody>\r\n<\/table>\r\n\r\n<br>\r\n\r\n<%= link_to 'New User', new_user_path %><\/pre>\n<p>\u5909\u66f4\u5f8c\uff1a<\/p>\n<pre class=\"decode:true \" ><p id=\"notice\"><%= notice %><\/p>\r\n\r\n<h1>Users<\/h1>\r\n\r\n<table>\r\n  <thead>\r\n    <tr>\r\n      <th>Name<\/th>\r\n      <th>Created at<\/th>\r\n      <th colspan=\"3\"><\/th>\r\n    <\/tr>\r\n  <\/thead>\r\n\r\n  <tbody>\r\n    <% @users.each do |user| %>\r\n      <tr>\r\n        <td><%= user.name %><\/td>\r\n        <td><%= user.created_at %><\/td>\r\n        <td><%= link_to 'Show', user %><\/td>\r\n        <td><%= link_to 'Edit', edit_user_path(user) %><\/td>\r\n        <td><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %><\/td>\r\n      <\/tr>\r\n    <% end %>\r\n  <\/tbody>\r\n<\/table>\r\n\r\n<br>\r\n\r\n<%= link_to 'New User', new_user_path %><\/pre>\n<p>\uff085\uff09<span style=\"color: #54a870;\"><strong>app\/views\/users\/show.html.erb<\/strong><\/span>\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p>\u300cCreated at\u300d\u3092\u8868\u793a\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u5909\u66f4\u524d\uff1a<\/p>\n<pre class=\"decode:true \" ><p id=\"notice\"><%= notice %><\/p>\r\n\r\n<p>\r\n  <strong>Name:<\/strong>\r\n  <%= @user.name %>\r\n<\/p>\r\n\r\n<%= link_to 'Edit', edit_user_path(@user) %> |\r\n<%= link_to 'Back', users_path %><\/pre>\n<p>\u5909\u66f4\u5f8c\uff1a<\/p>\n<pre class=\"decode:true \" ><p id=\"notice\"><%= notice %><\/p>\r\n\r\n<p>\r\n  <strong>Name:<\/strong>\r\n  <%= @user.name %>\r\n<\/p>\r\n<p>\r\n  <strong>Created at:<\/strong>\r\n  <%= @user.created_at %>\r\n<\/p>\r\n\r\n<%= link_to 'Edit', edit_user_path(@user) %> |\r\n<%= link_to 'Back', users_path %><\/pre>\n<p>\uff086\uff09\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"decode:true \" >bin\/rails server<\/pre>\n<p>User\u306e\u4e00\u89a7\u3092\u30d6\u30e9\u30a6\u30b6\u3067\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\uff085\uff09\u30d6\u30e9\u30a6\u30b6\u3067<span style=\"color: #54a870;\"><strong>\u300chttp:\/\/localhost:3000\/users\u300d<\/strong><\/span>\u306b\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator02.png\" alt=\"\" width=\"580\" height=\"332\" class=\"alignnone size-full wp-image-63800\" srcset=\"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator02.png 580w, https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator02-150x86.png 150w, https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator02-300x172.png 300w\" sizes=\"(max-width: 580px) 100vw, 580px\" \/><\/p>\n<p>\u300cCreated at\u300d\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u306d\u3002<\/p>\n<p>\u3053\u3053\u3067\u3044\u305a\u308c\u304b\u306e\u300cshow\u300d\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001\u3084\u306f\u308a\u300cCreated at\u300d\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u3053\u304b\u3089\u306f\u300cCreated at\u300d\u306e\u8868\u793a\u3092\u300c2018\/7\/13\u300d\u306b\u5909\u66f4\u3059\u308b\u305f\u3081\u306b\u3001Decorator\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<h3>Controller\u3092\u5909\u66f4\u3059\u308b<\/h3>\n<p>\u307e\u305a\u306f\u3001Controller\u304b\u3089View\u306b\u5bfe\u3057\u3066\u3001\u901a\u5e38\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u6e21\u3059\u4ee3\u308f\u308a\u306b\u3001Decorator\u4ed8\u304d\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u6e21\u3059\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p>\uff081\uff09<span style=\"color: #54a870;\"><strong>app\/controllers\/users_controller.rb<\/strong><\/span>\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p>\u5909\u66f4\u524d\uff1a<\/p>\n<pre class=\"decode:true \" >class UsersController < ApplicationController\r\n  before_action :set_user, only: [:show, :edit, :update, :destroy]\r\n\r\n  # GET \/users\r\n  # GET \/users.json\r\n  def index\r\n    @users = User.all\r\n  end\r\n\r\n  # GET \/users\/1\r\n  # GET \/users\/1.json\r\n  def show\r\n  end\r\n\uff08\u7701\u7565\uff09<\/pre>\n<p>\u5909\u66f4\u5f8c\uff1a<\/p>\n<pre class=\"decode:true \" >class UsersController < ApplicationController\r\n  before_action :set_user, only: [:show, :edit, :update, :destroy]\r\n\r\n  # GET \/users\r\n  # GET \/users.json\r\n  def index\r\n    @users = UserDecorator.decorate_collection(User.all)\r\n  end\r\n\r\n  # GET \/users\/1\r\n  # GET \/users\/1.json\r\n  def show\r\n    @user = User.find(params[:id]).decorate\r\n  end\r\n\uff08\u7701\u7565\uff09<\/pre>\n<p>\u300chttp:\/\/localhost:3000\/users\u300d\u3084\u300chttp:\/\/localhost:3000\/users\/1\u300d\u306b\u30a2\u30af\u30bb\u30b9\u3057\u305f\u3068\u304d\u306b\u3001Decorator\u3067\u6a5f\u80fd\u3092\u8ffd\u52a0\u3057\u305f\uff08\u8ffd\u52a0\u3059\u308b\u4e88\u5b9a\u306e\uff09@users\u307e\u305f\u306f@user\u3092\u53d6\u5f97\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u5148\u307b\u3069\u3068\u540c\u3058URL\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\uff082\uff09\u30d6\u30e9\u30a6\u30b6\u3067\u300chttp:\/\/localhost:3000\/users\u300d\u306b\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator02.png\" alt=\"\" width=\"580\" height=\"332\" class=\"alignnone size-full wp-image-63800\" srcset=\"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator02.png 580w, https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator02-150x86.png 150w, https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator02-300x172.png 300w\" sizes=\"(max-width: 580px) 100vw, 580px\" \/><\/p>\n<p>\u4f55\u3082\u5909\u308f\u3063\u3066\u3044\u306a\u3044\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u7121\u99c4\u306a\u3053\u3068\u3092\u3057\u305f\u306e\u304b!?\u3068\u601d\u3046\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u305d\u3046\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u3053\u3053\u3067\u306f\u3001@users\u3092Decorator\u3067\u6a5f\u80fd\u3092\u8ffd\u52a0\u3057\u305f\uff08\u8ffd\u52a0\u3059\u308b\u4e88\u5b9a\u306e\uff09\u30c7\u30fc\u30bf\u306b\u5dee\u3057\u66ff\u3048\u305f\u306b\u3082\u304b\u304b\u308f\u3089\u305a\u3001<span style=\"color: #254df2;\"><strong>\u4f55\u3082\u5909\u308f\u3089\u305a\u306bWeb\u30a2\u30d7\u30ea\u304c\u52d5\u4f5c\u3057\u3066\u3044\u308b\u3053\u3068<\/strong><\/span>\u304c\u91cd\u8981\u3067\u3059\u3002<\/p>\n<h3>Decorator\u3092\u5909\u66f4\u3059\u308b<\/h3>\n<p>\u6b21\u306b\u3001Decorator\uff08app\/decorators\/user_decorator.rb\uff09\u3092\u5909\u66f4\u3057\u3066\u3001def created_at\u3092\u5b9a\u7fa9\u3057\u3001\u6a5f\u80fd\u3092\u5909\u66f4\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u3001\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5909\u6570\u3068\u540c\u3058\u540d\u524d\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u5b9a\u7fa9\u3059\u308b\u3068\u3001View\u3084Model\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u306a\u304f\u3001Decorator\u3092\u5229\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\uff081\uff09<span style=\"color: #54a870;\"><strong>app\/decorators\/user_decorator.rb<\/strong><\/span>\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p>\u5909\u66f4\u524d\uff1a<\/p>\n<pre class=\"decode:true \" >class UserDecorator < Draper::Decorator\r\n  delegate_all\r\n\r\n  # Define presentation-specific methods here. Helpers are accessed through\r\n  # `helpers` (aka `h`). You can override attributes, for example:\r\n  #\r\n  #   def created_at\r\n  #     helpers.content_tag :span, class: 'time' do\r\n  #       object.created_at.strftime(\"%a %m\/%d\/%y\")\r\n  #     end\r\n  #   end\r\n\r\nend<\/pre>\n<p>\u5909\u66f4\u5f8c\uff1a<\/p>\n<pre class=\"decode:true \" >class UserDecorator < Draper::Decorator\r\n  delegate_all\r\n\r\n  # Define presentation-specific methods here. Helpers are accessed through\r\n  # `helpers` (aka `h`). You can override attributes, for example:\r\n  #\r\n  #   def created_at\r\n  #     helpers.content_tag :span, class: 'time' do\r\n  #       object.created_at.strftime(\"%a %m\/%d\/%y\")\r\n  #     end\r\n  #   end\r\n\r\n  def created_at\r\n    object.created_at.strftime(\"%Y\/%-m\/%-d\")\r\n  end\r\nend<\/pre>\n<p>\uff082\uff09\u30d6\u30e9\u30a6\u30b6\u3067<span style=\"color: #54a870;\"><strong>\u300chttp:\/\/localhost:3000\/users\u300d<\/strong><\/span>\u306b\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator03.png\" alt=\"\" width=\"580\" height=\"332\" class=\"alignnone size-full wp-image-63803\" srcset=\"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator03.png 580w, https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator03-150x86.png 150w, https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator03-300x172.png 300w\" sizes=\"(max-width: 580px) 100vw, 580px\" \/><\/p>\n<p>Decorator\u306edef created_at\u304c\u547c\u3073\u51fa\u3055\u308c\u3001\u65e5\u4ed8\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u304c\u5909\u308f\u3063\u3066\u3044\u307e\u3059\u306d\u3002<\/p>\n<p>\uff083\uff09\u300c\u5c71\u7530\u592a\u90ce\u300d\u306e<span style=\"color: #54a870;\"><strong>\u300cshow\u300d<\/strong><\/span>\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u3001http:\/\/localhost:3000\/users\/1\u306b\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator04.png\" alt=\"\" width=\"255\" height=\"147\" class=\"alignnone size-full wp-image-63804\" srcset=\"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator04.png 255w, https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator04-150x86.png 150w\" sizes=\"(max-width: 255px) 100vw, 255px\" \/><\/p>\n<p>\u3053\u3061\u3089\u3067\u3082Decorator\u306edef created_at\u304c\u547c\u3073\u51fa\u3055\u308c\u3001\u65e5\u4ed8\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u304c\u5909\u308f\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3>Model\u3068View\u3092\u5909\u66f4\u3057\u306a\u3044<\/h3>\n<p>\u3053\u3053\u307e\u3067\u3001<span style=\"color: #54a870;\"><strong>Controller<\/strong><\/span>\u3068<span style=\"color: #54a870;\"><strong>Decorator<\/strong><\/span>\u3092\u5909\u66f4\u3057\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u4e00\u65b9\u3001<span style=\"color: #f75959;\"><strong>Model\u3068View\u306f\u5909\u66f4\u3057\u3066\u3044\u307e\u305b\u3093\u3002<\/strong><\/span><\/p>\n<p>\u305d\u308c\u3067\u3082\u3001\u8868\u793a\u3092\u5909\u66f4\u3067\u304d\u305f\u3068\u3044\u3046\u3053\u3068\u306f\u3001\u521d\u3081\u306b\u8a71\u984c\u306b\u3057\u305f<span style=\"color: #f75959;\"><strong>Model\u3068View\u306e\u3069\u3063\u3061\u306b\u66f8\u304f\u306e\u554f\u984c<\/strong><\/span>\u306f\u3001<span style=\"color: #254df2;\"><strong>\u3069\u3063\u3061\u306b\u3082\u66f8\u304b\u306a\u3044\uff08Decorator\u306b\u66f8\u304f\uff09<\/strong><\/span>\u3068\u3044\u3046\u7d50\u8ad6\u306b\u81f3\u3063\u305f\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u306d\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u4eca\u56de\u306f\u3001<span style=\"color: #54a870;\"><strong>Draper<\/strong><\/span>\u306b\u3088\u308bDecorator\u306e\u5b9f\u88c5\u65b9\u6cd5\u3092\u7c21\u5358\u306b\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>Decorator\u3092\u4f7f\u3046\u3082\u3063\u3068\u3082\u5927\u304d\u306a\u30e1\u30ea\u30c3\u30c8\u306f\u3001<span style=\"color: #254df2;\"><strong>Model\u3092\u5909\u66f4\u3057\u306a\u304f\u3066\u3082\u3001View\u3092\u5909\u66f4\u3057\u306a\u304f\u3066\u3082\u3001\u8868\u793a\u3092\u5909\u66f4\u3067\u304d\u308b<\/strong><\/span>\u3068\u3044\u3046\u70b9\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306e\u3088\u3046\u306bcreated_at\u3068\u3044\u3046\u3001<span style=\"color: #254df2;\"><strong>\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5909\u6570\u3068\u540c\u3058\u540d\u524d\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u5b9a\u7fa9\u3059\u308b<\/strong><\/span>\u306e\u3082\u30dd\u30a4\u30f3\u30c8\u3067\u3057\u305f\u3002<\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u3001Decorater\u3067\u6a5f\u80fd\u3092\u8ffd\u52a0\u3057\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u3001\u6a5f\u80fd\u3092\u8ffd\u52a0\u3059\u308b\u524d\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u3001View\u3067\u533a\u5225\u3059\u308b\u5fc5\u8981\u304c\u306a\u3044\u3088\u3046\u306b\u3001<span style=\"color: #f75959;\"><strong>Decorator\u3092\u3046\u307e\u304f\u5b9a\u7fa9\u3059\u308b<\/strong><\/span>\u3001\u3068\u3044\u3046\u306e\u3082\u3001Decorator\u30d1\u30bf\u30fc\u30f3\u306e\u5927\u4e8b\u306a\u8003\u3048\u304b\u305f\u3067\u3059\u306e\u3067\u3001\u899a\u3048\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\u3001\u307e\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u56de\u306f\u3001Ruby on Rails\uff08\u4ee5\u964d\u3001Rails\uff09\u3067\u3001\u8ab0\u3082\u304c\u982d\u3092\u60a9\u307e\u305b\u3066\u3044\u308b\u3001\u3042\u308b\u554f\u984c\u30921\u3064\u89e3\u6c7a\u3057\u307e\u3057\u3087\u3046\u3002 \u305d\u308c\u306f\u3001 \u30fbModel\u3068View\u306e\u3069\u3063\u3061\u306b\u66f8\u304f\u306e\u554f\u984c \u3067\u3059\u3002 \u975e\u5e38\u306b\u7c21\u5358\u306a\u4f8b\u3067\u3001Model\u3067\u306f\u65e5\u6642\u3092\u201d20 [&hellip;]<\/p>\n","protected":false},"author":16433,"featured_media":63809,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"swell_btn_cv_data":"","footnotes":""},"categories":[2352],"tags":[],"class_list":["post-63786","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ruby-study"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u3010Rails\u5165\u9580\u3011View\u3068Model\u306e\u9593\u306bDecorator\uff08Draper\uff09\u3092\u7f6e\u304f | \u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0<\/title>\n<meta name=\"description\" content=\"\u3053\u306e\u8a18\u4e8b\u3067\u306f\u300c \u3010Rails\u5165\u9580\u3011View\u3068Model\u306e\u9593\u306bDecorator\uff08Draper\uff09\u3092\u7f6e\u304f \u300d\u306b\u3064\u3044\u3066\u3001\u8ab0\u3067\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3092\u8aad\u3081\u3070\u3001\u3042\u306a\u305f\u306e\u60a9\u307f\u304c\u89e3\u6c7a\u3059\u308b\u3060\u3051\u3058\u3083\u306a\u304f\u3001\u65b0\u305f\u306a\u6c17\u4ed8\u304d\u3082\u767a\u898b\u3067\u304d\u308b\u3053\u3068\u3067\u3057\u3087\u3046\u3002\u304a\u60a9\u307f\u306e\u65b9\u306f\u305c\u3072\u3054\u4e00\u8aad\u304f\u3060\u3055\u3044\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sejuku.net\/blog\/63786\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010Rails\u5165\u9580\u3011View\u3068Model\u306e\u9593\u306bDecorator\uff08Draper\uff09\u3092\u7f6e\u304f | \u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0\" \/>\n<meta property=\"og:description\" content=\"\u3053\u306e\u8a18\u4e8b\u3067\u306f\u300c \u3010Rails\u5165\u9580\u3011View\u3068Model\u306e\u9593\u306bDecorator\uff08Draper\uff09\u3092\u7f6e\u304f \u300d\u306b\u3064\u3044\u3066\u3001\u8ab0\u3067\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3092\u8aad\u3081\u3070\u3001\u3042\u306a\u305f\u306e\u60a9\u307f\u304c\u89e3\u6c7a\u3059\u308b\u3060\u3051\u3058\u3083\u306a\u304f\u3001\u65b0\u305f\u306a\u6c17\u4ed8\u304d\u3082\u767a\u898b\u3067\u304d\u308b\u3053\u3068\u3067\u3057\u3087\u3046\u3002\u304a\u60a9\u307f\u306e\u65b9\u306f\u305c\u3072\u3054\u4e00\u8aad\u304f\u3060\u3055\u3044\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sejuku.net\/blog\/63786\" \/>\n<meta property=\"og:site_name\" content=\"\u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/sejuku2013\" \/>\n<meta property=\"article:published_time\" content=\"1970-01-01T00:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-06T02:49:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"700\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@samuraijuku\" \/>\n<meta name=\"twitter:site\" content=\"@samuraijuku\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/63786#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/63786\"},\"author\":{\"name\":\"\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8\",\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/#\\\/schema\\\/person\\\/d20c57b59dba15001519a8a671183095\"},\"headline\":\"\u3010Rails\u5165\u9580\u3011View\u3068Model\u306e\u9593\u306bDecorator\uff08Draper\uff09\u3092\u7f6e\u304f\",\"datePublished\":\"1970-01-01T00:00:00+00:00\",\"dateModified\":\"2024-05-06T02:49:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/63786\"},\"wordCount\":245,\"publisher\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/63786#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/rails-decorator.jpg\",\"articleSection\":[\"Ruby\u5b66\u7fd2\"],\"inLanguage\":\"ja\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/63786\",\"url\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/63786\",\"name\":\"\u3010Rails\u5165\u9580\u3011View\u3068Model\u306e\u9593\u306bDecorator\uff08Draper\uff09\u3092\u7f6e\u304f | \u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/63786#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/63786#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/rails-decorator.jpg\",\"datePublished\":\"1970-01-01T00:00:00+00:00\",\"dateModified\":\"2024-05-06T02:49:40+00:00\",\"description\":\"\u3053\u306e\u8a18\u4e8b\u3067\u306f\u300c \u3010Rails\u5165\u9580\u3011View\u3068Model\u306e\u9593\u306bDecorator\uff08Draper\uff09\u3092\u7f6e\u304f \u300d\u306b\u3064\u3044\u3066\u3001\u8ab0\u3067\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3092\u8aad\u3081\u3070\u3001\u3042\u306a\u305f\u306e\u60a9\u307f\u304c\u89e3\u6c7a\u3059\u308b\u3060\u3051\u3058\u3083\u306a\u304f\u3001\u65b0\u305f\u306a\u6c17\u4ed8\u304d\u3082\u767a\u898b\u3067\u304d\u308b\u3053\u3068\u3067\u3057\u3087\u3046\u3002\u304a\u60a9\u307f\u306e\u65b9\u306f\u305c\u3072\u3054\u4e00\u8aad\u304f\u3060\u3055\u3044\u3002\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/63786#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/63786\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/63786#primaryimage\",\"url\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/rails-decorator.jpg\",\"contentUrl\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/rails-decorator.jpg\",\"width\":700,\"height\":400},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/63786#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010Rails\u5165\u9580\u3011View\u3068Model\u306e\u9593\u306bDecorator\uff08Draper\uff09\u3092\u7f6e\u304f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/\",\"name\":\"\u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0\",\"description\":\"\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u5b66\u7fd2\u306e\u3059\u3079\u3066\u304c\u30b3\u30b3\u306b\u3002\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ja\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/#organization\",\"name\":\"\u682a\u5f0f\u4f1a\u793eSAMURAI\",\"url\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/logo.png\",\"contentUrl\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/logo.png\",\"width\":600,\"height\":600,\"caption\":\"\u682a\u5f0f\u4f1a\u793eSAMURAI\"},\"image\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/sejuku2013\",\"https:\\\/\\\/x.com\\\/samuraijuku\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCCFOQO5aDK0xXam4cUQXT8g\\\/featured\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/#\\\/schema\\\/person\\\/d20c57b59dba15001519a8a671183095\",\"name\":\"\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d91ed20aaa7f873a0f4f35586561303460c1e3864746dddb6ebe0fb093c1952d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d91ed20aaa7f873a0f4f35586561303460c1e3864746dddb6ebe0fb093c1952d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d91ed20aaa7f873a0f4f35586561303460c1e3864746dddb6ebe0fb093c1952d?s=96&d=mm&r=g\",\"caption\":\"\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8\"},\"description\":\"\u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u587e\u306f\u300c\u4eba\u751f\u3092\u5909\u3048\u308b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u5b66\u7fd2\u300d\u3092\u30b3\u30f3\u30bb\u30f3\u30d7\u30c8\u306b\u3001\u904e\u53bb\u591a\u304f\u306e\u30d5\u30ea\u30fc\u30e9\u30f3\u30b9\u30a8\u30f3\u30b8\u30cb\u30a2\u3092\u8f29\u51fa\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb\u3067\u3059\u3002\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8\u3067\u306f\u6280\u8853\u7cfb\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u4e2d\u5fc3\u306b\u6709\u7528\u306a\u60c5\u5831\u3092\u767a\u4fe1\u3057\u3066\u3044\u304d\u307e\u3059\u3002\",\"url\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/author\\\/samurai-tech\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010Rails\u5165\u9580\u3011View\u3068Model\u306e\u9593\u306bDecorator\uff08Draper\uff09\u3092\u7f6e\u304f | \u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0","description":"\u3053\u306e\u8a18\u4e8b\u3067\u306f\u300c \u3010Rails\u5165\u9580\u3011View\u3068Model\u306e\u9593\u306bDecorator\uff08Draper\uff09\u3092\u7f6e\u304f \u300d\u306b\u3064\u3044\u3066\u3001\u8ab0\u3067\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3092\u8aad\u3081\u3070\u3001\u3042\u306a\u305f\u306e\u60a9\u307f\u304c\u89e3\u6c7a\u3059\u308b\u3060\u3051\u3058\u3083\u306a\u304f\u3001\u65b0\u305f\u306a\u6c17\u4ed8\u304d\u3082\u767a\u898b\u3067\u304d\u308b\u3053\u3068\u3067\u3057\u3087\u3046\u3002\u304a\u60a9\u307f\u306e\u65b9\u306f\u305c\u3072\u3054\u4e00\u8aad\u304f\u3060\u3055\u3044\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sejuku.net\/blog\/63786","og_locale":"ja_JP","og_type":"article","og_title":"\u3010Rails\u5165\u9580\u3011View\u3068Model\u306e\u9593\u306bDecorator\uff08Draper\uff09\u3092\u7f6e\u304f | \u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0","og_description":"\u3053\u306e\u8a18\u4e8b\u3067\u306f\u300c \u3010Rails\u5165\u9580\u3011View\u3068Model\u306e\u9593\u306bDecorator\uff08Draper\uff09\u3092\u7f6e\u304f \u300d\u306b\u3064\u3044\u3066\u3001\u8ab0\u3067\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3092\u8aad\u3081\u3070\u3001\u3042\u306a\u305f\u306e\u60a9\u307f\u304c\u89e3\u6c7a\u3059\u308b\u3060\u3051\u3058\u3083\u306a\u304f\u3001\u65b0\u305f\u306a\u6c17\u4ed8\u304d\u3082\u767a\u898b\u3067\u304d\u308b\u3053\u3068\u3067\u3057\u3087\u3046\u3002\u304a\u60a9\u307f\u306e\u65b9\u306f\u305c\u3072\u3054\u4e00\u8aad\u304f\u3060\u3055\u3044\u3002","og_url":"https:\/\/www.sejuku.net\/blog\/63786","og_site_name":"\u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0","article_publisher":"https:\/\/www.facebook.com\/sejuku2013","article_published_time":"1970-01-01T00:00:00+00:00","article_modified_time":"2024-05-06T02:49:40+00:00","og_image":[{"width":700,"height":400,"url":"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator.jpg","type":"image\/jpeg"}],"author":"\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8","twitter_card":"summary_large_image","twitter_creator":"@samuraijuku","twitter_site":"@samuraijuku","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.sejuku.net\/blog\/63786#article","isPartOf":{"@id":"https:\/\/www.sejuku.net\/blog\/63786"},"author":{"name":"\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8","@id":"https:\/\/www.sejuku.net\/blog\/#\/schema\/person\/d20c57b59dba15001519a8a671183095"},"headline":"\u3010Rails\u5165\u9580\u3011View\u3068Model\u306e\u9593\u306bDecorator\uff08Draper\uff09\u3092\u7f6e\u304f","datePublished":"1970-01-01T00:00:00+00:00","dateModified":"2024-05-06T02:49:40+00:00","mainEntityOfPage":{"@id":"https:\/\/www.sejuku.net\/blog\/63786"},"wordCount":245,"publisher":{"@id":"https:\/\/www.sejuku.net\/blog\/#organization"},"image":{"@id":"https:\/\/www.sejuku.net\/blog\/63786#primaryimage"},"thumbnailUrl":"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator.jpg","articleSection":["Ruby\u5b66\u7fd2"],"inLanguage":"ja"},{"@type":"WebPage","@id":"https:\/\/www.sejuku.net\/blog\/63786","url":"https:\/\/www.sejuku.net\/blog\/63786","name":"\u3010Rails\u5165\u9580\u3011View\u3068Model\u306e\u9593\u306bDecorator\uff08Draper\uff09\u3092\u7f6e\u304f | \u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0","isPartOf":{"@id":"https:\/\/www.sejuku.net\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.sejuku.net\/blog\/63786#primaryimage"},"image":{"@id":"https:\/\/www.sejuku.net\/blog\/63786#primaryimage"},"thumbnailUrl":"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator.jpg","datePublished":"1970-01-01T00:00:00+00:00","dateModified":"2024-05-06T02:49:40+00:00","description":"\u3053\u306e\u8a18\u4e8b\u3067\u306f\u300c \u3010Rails\u5165\u9580\u3011View\u3068Model\u306e\u9593\u306bDecorator\uff08Draper\uff09\u3092\u7f6e\u304f \u300d\u306b\u3064\u3044\u3066\u3001\u8ab0\u3067\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3092\u8aad\u3081\u3070\u3001\u3042\u306a\u305f\u306e\u60a9\u307f\u304c\u89e3\u6c7a\u3059\u308b\u3060\u3051\u3058\u3083\u306a\u304f\u3001\u65b0\u305f\u306a\u6c17\u4ed8\u304d\u3082\u767a\u898b\u3067\u304d\u308b\u3053\u3068\u3067\u3057\u3087\u3046\u3002\u304a\u60a9\u307f\u306e\u65b9\u306f\u305c\u3072\u3054\u4e00\u8aad\u304f\u3060\u3055\u3044\u3002","breadcrumb":{"@id":"https:\/\/www.sejuku.net\/blog\/63786#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sejuku.net\/blog\/63786"]}]},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.sejuku.net\/blog\/63786#primaryimage","url":"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator.jpg","contentUrl":"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails-decorator.jpg","width":700,"height":400},{"@type":"BreadcrumbList","@id":"https:\/\/www.sejuku.net\/blog\/63786#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sejuku.net\/blog\/"},{"@type":"ListItem","position":2,"name":"\u3010Rails\u5165\u9580\u3011View\u3068Model\u306e\u9593\u306bDecorator\uff08Draper\uff09\u3092\u7f6e\u304f"}]},{"@type":"WebSite","@id":"https:\/\/www.sejuku.net\/blog\/#website","url":"https:\/\/www.sejuku.net\/blog\/","name":"\u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0","description":"\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u5b66\u7fd2\u306e\u3059\u3079\u3066\u304c\u30b3\u30b3\u306b\u3002","publisher":{"@id":"https:\/\/www.sejuku.net\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sejuku.net\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ja"},{"@type":"Organization","@id":"https:\/\/www.sejuku.net\/blog\/#organization","name":"\u682a\u5f0f\u4f1a\u793eSAMURAI","url":"https:\/\/www.sejuku.net\/blog\/","logo":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.sejuku.net\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2023\/07\/logo.png","contentUrl":"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2023\/07\/logo.png","width":600,"height":600,"caption":"\u682a\u5f0f\u4f1a\u793eSAMURAI"},"image":{"@id":"https:\/\/www.sejuku.net\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/sejuku2013","https:\/\/x.com\/samuraijuku","https:\/\/www.youtube.com\/channel\/UCCFOQO5aDK0xXam4cUQXT8g\/featured"]},{"@type":"Person","@id":"https:\/\/www.sejuku.net\/blog\/#\/schema\/person\/d20c57b59dba15001519a8a671183095","name":"\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/secure.gravatar.com\/avatar\/d91ed20aaa7f873a0f4f35586561303460c1e3864746dddb6ebe0fb093c1952d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d91ed20aaa7f873a0f4f35586561303460c1e3864746dddb6ebe0fb093c1952d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d91ed20aaa7f873a0f4f35586561303460c1e3864746dddb6ebe0fb093c1952d?s=96&d=mm&r=g","caption":"\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8"},"description":"\u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u587e\u306f\u300c\u4eba\u751f\u3092\u5909\u3048\u308b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u5b66\u7fd2\u300d\u3092\u30b3\u30f3\u30bb\u30f3\u30d7\u30c8\u306b\u3001\u904e\u53bb\u591a\u304f\u306e\u30d5\u30ea\u30fc\u30e9\u30f3\u30b9\u30a8\u30f3\u30b8\u30cb\u30a2\u3092\u8f29\u51fa\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb\u3067\u3059\u3002\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8\u3067\u306f\u6280\u8853\u7cfb\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u4e2d\u5fc3\u306b\u6709\u7528\u306a\u60c5\u5831\u3092\u767a\u4fe1\u3057\u3066\u3044\u304d\u307e\u3059\u3002","url":"https:\/\/www.sejuku.net\/blog\/author\/samurai-tech"}]}},"_links":{"self":[{"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/posts\/63786","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/users\/16433"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/comments?post=63786"}],"version-history":[{"count":0,"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/posts\/63786\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/media\/63809"}],"wp:attachment":[{"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/media?parent=63786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/categories?post=63786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/tags?post=63786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}