{"id":11783,"date":"2020-09-16T13:49:13","date_gmt":"2020-09-16T04:49:13","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=11783"},"modified":"2023-05-01T09:00:50","modified_gmt":"2023-05-01T00:00:50","slug":"%e3%80%90ruby-on-rails%e3%80%91%e3%82%a8%e3%82%b9%e3%82%b1%e3%83%bc%e3%83%97%e9%96%a2%e9%80%a3%e3%81%ae%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=11783","title":{"rendered":"\u3010Ruby on Rails\u3011\u30d3\u30e5\u30fc\u30d8\u30eb\u30d1\u30fc\uff08\u30a8\u30b9\u30b1\u30fc\u30d7\u95a2\u9023\u3001\u30bf\u30b0\u95a2\u9023\u306a\u3069\uff09"},"content":{"rendered":"<h2>\u30d3\u30e5\u30fc\u30d8\u30eb\u30d1\u30fc\u3068\u306f\uff1f<\/h2>\n<p>\u30d3\u30e5\u30fc\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\uff08ERB\uff09\u3092\u8a18\u8ff0\u3059\u308b\u969b\u306b\u5f79\u7acb\u3064\u30e1\u30bd\u30c3\u30c9\u306e\u7dcf\u79f0\u3067\u3059\u3002\u30d5\u30a9\u30fc\u30e0\u8981\u7d20\u751f\u6210\u3092\u521d\u3081\u69d8\u3005\u306a\u30d3\u30e5\u30fc\u30d8\u30eb\u30d1\u30fc\u304c\u3042\u308a\u307e\u3059\u3002\u306a\u304a\u3001\u30d3\u30e5\u30fc\u30d8\u30eb\u30d1\u30fc\u306f\u81ea\u4f5c\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u306a\u306e\u3067\u3082\u3057<span style=\"color: #ff0000;\"><strong>\u3053\u3046\u3044\u3046\u6a5f\u80fd\u304c\u6b32\u3057\u3044<\/strong><\/span>\u3068\u3044\u3046\u3053\u3068\u3092\u601d\u3044\u3064\u3044\u305f\u3089\u81ea\u4f5c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>\u6587\u5b57\u5217\u6570\u5024\u95a2\u9023\u306e\u30d3\u30e5\u30fc\u30d8\u30eb\u30d1\u30fc<\/h2>\n<h3>pluralize\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u6587\u5b57\u5217\u3092\u8907\u6570\u5f62\u306b\u5909\u63db\u3057\u307e\u3059\u3002<\/p>\n<h3>truncate\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u6307\u5b9a\u3057\u305f\u6841\u6570\u3067\u5207\u308a\u6368\u3066\u307e\u3059\u3002<\/p>\n<h3>excerpt\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u6587\u5b57\u5217\u304b\u3089\u7279\u5b9a\u306e\u6587\u5b57\u5217\u306e\u307f\u629c\u7c8b\u3059\u308b\u3002<\/p>\n<h3>cycle\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u30c6\u30fc\u30d6\u30eb\u30ea\u30b9\u30c8\u306e\u80cc\u666f\u8272\u3092n\u884c\u304a\u304d\u306b\u5909\u66f4\u3059\u308b\u3002<\/p>\n<h3>highlight\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u7279\u5b9a\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u30cf\u30a4\u30e9\u30a4\u30c8\u8868\u793a\u3059\u308b\u3002<\/p>\n<h3>concat\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u30d6\u30ed\u30c3\u30af\uff08&lt;% \u301c %&gt;)\u306e\u4e2d\u306b\u51fa\u529b\u30b3\u30fc\u30c9\u3092\u57cb\u3081\u8fbc\u3080\uff09<\/p>\n<h3>simple_format\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u6587\u5b57\u5217\u3092p\u30bf\u30b0\u3067\u56f2\u3044\u3001\u6539\u884c\u3092\u7f6e\u63db\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<h4>sanitize\u30aa\u30d7\u30b7\u30e7\u30f3<\/h4>\n<p>\u30c6\u30ad\u30b9\u30c8\u306b\u542b\u307e\u308c\u308b\u4e00\u90e8\u5371\u967a\u306aHTML\u30bf\u30b0\u3092\u53d6\u308a\u9664\u3044\u3066\u304f\u308c\u307e\u3059\u3002\u305f\u3060\u3001\u4e00\u90e8\u306e\u30bf\u30b0\u3057\u304b\u5b89\u5168\u306a\u5f62\u306b\u3067\u304d\u306a\u3044\u306e\u3067<span style=\"color: #ff0000;\"><strong>\u5168\u3066\u306e\u30bf\u30b0\u3092\u5b89\u5168\u306b\u3057\u305f\u3044\u5834\u5408\u306ffalse\u306b\u3057\u3066h\u30e1\u30bd\u30c3\u30c9\u3067\u5b9f\u88c5\u3059\u308b\u3068\u826f\u3044<\/strong><\/span>\u3067\u3057\u3087\u3046\u3002<\/p>\n<h4>wrapper_tag\u30aa\u30d7\u30b7\u30e7\u30f3<\/h4>\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u56f2\u307e\u308c\u308b\u30bf\u30b0\u306fp\u30bf\u30b0\u3067\u3059\u304c\u3001div\u7b49\u56f2\u3080\u30bf\u30b0\u3092\u4ed6\u306e\u30bf\u30b0\u306b\u7f6e\u63db\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>sprintf\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u6587\u5b57\u5217\u3092\u6307\u5b9a\u3057\u305f\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306b\u6574\u5f62\u3059\u308b\u3002<\/p>\n<h3>number_xxxx\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u6570\u5024\u3092\u69d8\u3005\u306a\u5f62\u5f0f\u306b\u52a0\u5de5\u3059\u308b\u3002\uff08\u5186\u3084\u30c9\u30eb\u3084KB\u7b49\uff09<\/p>\n<h3>strftime\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u65e5\u4ed8\u30c7\u30fc\u30bf\u3092\u6574\u5f62\u3059\u308b\u3002<\/p>\n<h2>\u30ea\u30f3\u30af\u95a2\u9023\u306e\u30d3\u30e5\u30fc\u30d8\u30eb\u30d1\u30fc<\/h2>\n<h3>link_to\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p><strong>\u30c6\u30ad\u30b9\u30c8\u30ea\u30f3\u30af\u3092\u751f\u6210\u3059\u308b\u30d3\u30e5\u30fc\u30d8\u30eb\u30d1\u30fc<\/strong>\u3067\u3059\u3002\u666e\u901a\u306ba\u30bf\u30b0\u3092\u4f7f\u3063\u3066\u66f8\u304f\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u304c\u3053\u3061\u3089\u306e\u65b9\u304c<span style=\"color: #ff0000;\"><strong>\u30e2\u30c7\u30eb\u3084\u30eb\u30fc\u30c8\u3068\u9023\u643a\u3067\u304d\u308b\u7b49Rails\u306e\u6a5f\u80fd\u3068\u306e\u89aa\u548c\u6027\u304c\u9ad8\u3044<\/strong><\/span>\u306e\u3067\u512a\u5148\u7684\u306b\u4f7f\u3044\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>url_for\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u30eb\u30fc\u30c8\u5b9a\u7fa9\u304b\u3089\u52d5\u7684\u306bURL\u3092\u751f\u6210\u3059\u308b\u3002<\/p>\n<h3>link_to_if\/link_to_unless\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u6761\u4ef6\u306b\u5fdc\u3058\u3066\u30ea\u30f3\u30af\u3092\u751f\u6210\u3059\u308b\u3002<\/p>\n<h3>link_to_unless_current\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u73fe\u5728\u306e\u30da\u30fc\u30b8\u306e\u5834\u5408\u306f\u30ea\u30f3\u30af\u3092\u7121\u52b9\u5316\u3059\u308b\u3002<\/p>\n<h3>mail_to\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3078\u306e\u30ea\u30f3\u30af\u3092\u751f\u6210\u3059\u308b\u3002<\/p>\n<h2>\u5916\u90e8\u30ea\u30bd\u30fc\u30b9\u6307\u5b9a\u306e\u305f\u3081\u306e\u30d3\u30e5\u30fc\u30d8\u30eb\u30d1\u30fc(Asset\u30d8\u30eb\u30d1\u30fc\uff09<\/h2>\n<h3>image_tag\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u753b\u50cf\u3092\u8868\u793a\u3059\u308b\u3002<\/p>\n<h3>audio_tag\/video_tag\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u97f3\u58f0\u3084\u52d5\u753b\u3092\u30d6\u30e9\u30a6\u30b6\u3067\u518d\u751f\u3059\u308b\u3002<\/p>\n<h3>auto_discovery_link_tag\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u30d6\u30e9\u30a6\u30b6\u306e\u30d5\u30a3\u30fc\u30c9\u691c\u51fa\u6a5f\u80fd\u3092\u6709\u52b9\u306b\u3059\u308b\u3002\uff08RSS\u30d5\u30a3\u30fc\u30c9\u3084Atom\u30d5\u30a3\u30fc\u30c9\u7b49\uff09<\/p>\n<h3>favicon_link_tag\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u30b5\u30a4\u30c8\u306e\u30d5\u30a1\u30d3\u30b3\u30f3\u3092\u5b9a\u7fa9\u3059\u308b\u3002<\/p>\n<h3>stylesheet_link_tag\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u8aad\u307f\u8fbc\u307e\u305b\u308bCSS\u30d5\u30a1\u30a4\u30eb\u3092\u5b9a\u7fa9\u3059\u308b\u3002<\/p>\n<h3>javascript_include_tag\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u8aad\u307f\u8fbc\u307e\u305b\u308bJavaScript\u30d5\u30a1\u30a4\u30eb\u3092\u5b9a\u7fa9\u3059\u308b\u3002Webpack\u3067\u30d3\u30eb\u30c9\u3057\u305fJavaScript\u3092\u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<h3>xxx_path\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u5916\u90e8\u30ea\u30bd\u30fc\u30b9\u306e\u30d1\u30b9\u3092\u53d6\u5f97\u3059\u308b\u3002<\/p>\n<h2>\u305d\u306e\u4ed6\u306e\u30d3\u30e5\u30fc\u30d8\u30eb\u30d1\u30fc<\/h2>\n<h3>debug\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u69cb\u9020\u5316\u30c7\u30fc\u30bf(\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306b\u6e21\u3055\u308c\u305f\u914d\u5217\u3084\u30aa\u30d6\u30b8\u30a7\u30af\u30c8)\u3092\u30c0\u30f3\u30d7\u51fa\u529b(YAML\u5f62\u5f0f)\u3059\u308b\u3002<\/p>\n<h3>capture\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u65ad\u7247\u7684\u306a\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u51fa\u529b\u7d50\u679c\u3092\u5909\u6570\u306b\u683c\u7d0d\u3059\u308b\u3002<\/p>\n<h3>tag\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>Rails5.1\u3067\u8ffd\u52a0\u3055\u308c\u305f\u30bf\u30b0\u3092\u751f\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u30d3\u30e5\u30fc\u30d8\u30eb\u30d1\u30fc\u3067\u3059\u3002\u5f93\u6765\u304b\u3089\u3042\u308bcontent_tag\u30e1\u30bd\u30c3\u30c9\u306b\u6bd4\u3079\u3066\u30b7\u30f3\u30d7\u30eb\u306b\u8a18\u8ff0\u53ef\u80fd\u3067\u3059\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u3067HTML5\u3082\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h4>\u69cb\u6587<\/h4>\n<pre class=\"lang:default decode:true \">tag.\u30bf\u30b0\u540d<\/pre>\n<h4>\u4f8b<\/h4>\n<pre class=\"lang:default decode:true\">tag.span class: 'test'<\/pre>\n<p>\u4e0a\u8a18\u306e\u8a18\u8ff0\u3067\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306a\u30bf\u30b0\u304c\u751f\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">&lt;span class=\"test\"&gt;&lt;\/span&gt;<\/pre>\n<h3>content_tag\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u30bf\u30b0\u3092\u751f\u6210\u3067\u304d\u308b\u30d3\u30e5\u30fc\u30d8\u30eb\u30d1\u30fc\u3067\u3059\u3002\u30ec\u30ac\u30b7\u30fc\u306a\u8a18\u6cd5\u3067\u3042\u308b\u3068\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3067\u304d\u308b\u305f\u3051tag\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046\u3088\u3046\u306b\u3057\u305f\u65b9\u304c\u826f\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"lang:default decode:true\">content_tag :span, nil, class: 'test'<\/pre>\n<p>\u4e0a\u8a18\u306e\u8a18\u8ff0\u3067\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306a\u30bf\u30b0\u304c\u751f\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">&lt;span class=\"test\"&gt;&lt;\/span&gt;<\/pre>\n<h2>\u30a8\u30b9\u30b1\u30fc\u30d7\u3059\u308b<\/h2>\n<h3>&lt;%= \u6587\u5b57 %&gt;<\/h3>\n<p>erb\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u30a8\u30b9\u30b1\u30fc\u30d7\u3057\u307e\u3059\u3002<\/p>\n<h3>h<\/h3>\n<p>html_escape\u3068\u540c\u3058\u3067\u3059\u3002<\/p>\n<p>XSS\uff08\u30af\u30ed\u30b9\u30b5\u30a4\u30c8\u30b9\u30af\u30ea\u30d7\u30c6\u30a3\u30f3\u30b0\uff09\u306e\u5bfe\u7b56\u3092\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u300c&lt;\u300d\u3067\u3042\u308c\u3070\u300c&amp;lt;\u300d\u306b\u7f6e\u63db\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<h3>sanitize\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u4e0e\u3048\u3089\u308c\u305f\u6587\u5b57\u5217\u304b\u3089HTML\u306e\u5c5e\u6027\u3092\u9664\u53bb\u3059\u308b\u3002\uff08\u30b5\u30cb\u30bf\u30a4\u30ba\u3059\u308b\u3002\uff09<\/p>\n<h3>html_escape<\/h3>\n<p>h\u306e\u30a8\u30a4\u30ea\u30a2\u30b9\u30e1\u30bd\u30c3\u30c9\u3067\u540c\u3058\u3067\u3059\u3002<\/p>\n<h3>safe_join(\u914d\u5217,\u6539\u884c)<\/h3>\n<p>\u914d\u5217\u306b\u542b\u307e\u308c\u308b\u6587\u5b57\u3092\u30a8\u30b9\u30b1\u30fc\u30d7\u3057\u3066\u7d50\u5408\u3057\u3066\u3001&lt;br&gt;\u3092\u52a0\u3048\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<h2>\u30a8\u30b9\u30b1\u30fc\u30d7\u3057\u306a\u3044<\/h2>\n<h3>html_safe<\/h3>\n<p>nil\u306b\u306fhtml_safe\u304c\u306a\u3044\u306e\u3067\u4f8b\u5916\u304c\u767a\u751f\u3057\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<h3>raw<\/h3>\n<p>nil\u3067\u3082\u4f7f\u3048\u308b\u306e\u3067\u300chtml_safe\u300d\u3088\u308a\u3082\u826f\u3044\u3089\u3057\u3044\u3067\u3059\u3002<\/p>\n<h3>&lt;%== \u6587\u5b57 %&gt;<\/h3>\n<p>raw\u3088\u308a\u3082\u826f\u3044\u3057\u3001nil\u3067\u3082\u30a8\u30e9\u30fc\u304c\u8d77\u304d\u306a\u3044\u306e\u3067raw\u3088\u308a\u3082\u826f\u3044\u3089\u3057\u3044\u3002<\/p>\n<h3>simple_format<\/h3>\n<p>p\u30bf\u30b0\u3084\u6539\u884c\u30b3\u30fc\u30c9\u3092br\u306b\u7f6e\u63db\u3057\u3066\u304f\u308c\u307e\u3059\u3002h\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f75\u7528\u3059\u308c\u3070\u30a8\u30b9\u30b1\u30fc\u30d7\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u30d3\u30e5\u30fc\u30d8\u30eb\u30d1\u30fc\u3068\u306f\uff1f \u30d3\u30e5\u30fc\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\uff08ERB\uff09\u3092\u8a18\u8ff0\u3059\u308b\u969b\u306b\u5f79\u7acb\u3064\u30e1\u30bd\u30c3\u30c9\u306e\u7dcf\u79f0\u3067\u3059\u3002\u30d5\u30a9\u30fc\u30e0\u8981\u7d20\u751f\u6210\u3092\u521d\u3081\u69d8\u3005\u306a\u30d3\u30e5\u30fc\u30d8\u30eb\u30d1\u30fc\u304c\u3042\u308a\u307e\u3059\u3002\u306a\u304a\u3001\u30d3\u30e5\u30fc\u30d8\u30eb\u30d1\u30fc\u306f\u81ea\u4f5c\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u306a\u306e\u3067\u3082\u3057\u3053\u3046\u3044\u3046\u6a5f\u80fd\u304c\u6b32 [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[36],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/11783"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11783"}],"version-history":[{"count":7,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/11783\/revisions"}],"predecessor-version":[{"id":19366,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/11783\/revisions\/19366"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11783"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11783"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}