{"id":114,"date":"2024-09-09T15:43:49","date_gmt":"2024-09-09T06:43:49","guid":{"rendered":"https:\/\/dexall.co.jp\/articles\/?p=114"},"modified":"2025-03-24T08:55:05","modified_gmt":"2025-03-23T23:55:05","slug":"ruby-on-rails-params%e3%83%9e%e3%82%b9%e3%82%bf%e3%83%bc%e8%ac%9b%e5%ba%a7%ef%bc%9a%e5%9f%ba%e7%a4%8e%e3%81%8b%e3%82%89%e5%bf%9c%e7%94%a8%e3%81%be%e3%81%a7%e5%ae%8c%e5%85%a8%e8%a7%a3%e8%aa%ac%ef%bc%81","status":"publish","type":"post","link":"https:\/\/dexall.co.jp\/articles\/?p=114","title":{"rendered":"Ruby on Rails params\u30de\u30b9\u30bf\u30fc\u8b1b\u5ea7\uff1a\u57fa\u790e\u304b\u3089\u5fdc\u7528\u307e\u3067\u5b8c\u5168\u89e3\u8aac\uff01"},"content":{"rendered":"\n<p>Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u304a\u3044\u3066\u3001\u30e6\u30fc\u30b6\u30fc\u304b\u3089\u306e\u30c7\u30fc\u30bf\u3092\u9069\u5207\u306b\u6271\u3046\u3053\u3068\u306f\u975e\u5e38\u306b\u91cd\u8981\u3067\u3059\u3002<br>Ruby on Rails\u3067\u306f\u3001<code>params<\/code>\u3068\u3044\u3046\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u901a\u3058\u3066\u3053\u308c\u3092\u5b9f\u73fe\u3057\u3066\u3044\u307e\u3059\u3002<br>\u3057\u304b\u3057\u3001<code>params<\/code>\u306e\u4f7f\u3044\u65b9\u3092\u5b8c\u5168\u306b\u7406\u89e3\u3057\u3001\u52b9\u7387\u7684\u304b\u3064\u30bb\u30ad\u30e5\u30a2\u306b\u6d3b\u7528\u3067\u304d\u3066\u3044\u307e\u3059\u304b\uff1f<\/p>\n\n\n\n<p>\u672c\u8a18\u4e8b\u3067\u306f\u3001Ruby on Rails\u306b\u304a\u3051\u308b<code>params<\/code>\u306e\u57fa\u672c\u6982\u5ff5\u304b\u3089\u9ad8\u5ea6\u306a\u6d3b\u7528\u6cd5\u307e\u3067\u3001\u5fb9\u5e95\u7684\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002<br>\u521d\u5fc3\u8005\u306e\u65b9\u306f\u3082\u3061\u308d\u3093\u3001\u4e2d\u7d1a\u8005\u306e\u65b9\u306b\u3082\u65b0\u305f\u306a\u767a\u898b\u304c\u3042\u308b\u306f\u305a\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u30c8\u30d4\u30c3\u30af\u306b\u3064\u3044\u3066\u3001\u8a73\u3057\u304f\u8aac\u660e\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-sgb-block-simple sgb-box-simple sgb-box-simple--title-normal sgb-box-simple--with-border\"><div style=\"background-color:var(--wp--preset--color--sango-main);color:#FFF\" class=\"sgb-box-simple__title\">\u3053\u306e\u8a18\u4e8b\u3092\u901a\u3057\u3066\u7406\u89e3\u3067\u304d\u308b8\u3064\u306e\u3053\u3068<\/div><div class=\"sgb-box-simple__body\" style=\"border-color:var(--wp--preset--color--sango-main);background-color:#FFF\">\n<ol class=\"wp-block-list\">\n<li>params\u306e\u57fa\u672c\u6982\u5ff5\u3068\u91cd\u8981\u6027<\/li>\n\n\n\n<li>\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u3068\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3067\u306e\u6d3b\u7528\u6cd5<\/li>\n\n\n\n<li>Strong Parameters\u3092\u4f7f\u3063\u305f\u5b89\u5168\u306a\u30c7\u30fc\u30bf\u51e6\u7406<\/li>\n\n\n\n<li>\u8907\u96d1\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u3067\u306e\u6d3b\u7528\u30c6\u30af\u30cb\u30c3\u30af<\/li>\n\n\n\n<li>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/li>\n\n\n\n<li>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u306e\u30b3\u30c4<\/li>\n\n\n\n<li>\u5b9f\u8df5\u7684\u306a\u4f7f\u7528\u4f8b\u3068\u5fdc\u7528\u30c6\u30af\u30cb\u30c3\u30af<\/li>\n\n\n\n<li>\u30c6\u30b9\u30c8\u6226\u7565\u3068\u54c1\u8cea\u4fdd\u8a3c<\/li>\n<\/ol>\n<\/div><\/div>\n\n\n\n<p>\u3053\u306e\u8a18\u4e8b\u3092\u8aad\u307f\u7d42\u3048\u305f\u5f8c\u306b\u306f\u3001<code>params<\/code>\u3092\u4f7f\u3044\u3053\u306a\u3057\u3001\u3088\u308a\u5b89\u5168\u3067\u52b9\u7387\u7684\u306aRails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u767a\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u3053\u3068\u3067\u3057\u3087\u3046\u3002<br>\u3055\u3042\u3001\u4e00\u7dd2\u306bRuby on Rails\u306e<code>params<\/code>\u30de\u30b9\u30bf\u30fc\u3078\u306e\u9053\u3092\u6b69\u3093\u3067\u3044\u304d\u307e\u3057\u3087\u3046\uff01<\/p>\n\n\n\n<div class=\"toc\"><br \/>\n<b>Warning<\/b>:  Undefined array key \"is_admin\" in <b>\/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>116<\/b><br \/>\n<br \/>\n<b>Warning<\/b>:  Undefined array key \"is_category_top\" in <b>\/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>121<\/b><br \/>\n<br \/>\n<b>Warning<\/b>:  Undefined array key \"is_top\" in <b>\/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>128<\/b><br \/>\n    <div id=\"toc_container\" class=\"sgb-toc--bullets js-smooth-scroll\" data-dialog-title=\"\u76ee\u6b21\">\n      <p class=\"toc_title\">\u76ee\u6b21 <\/p>\n      <ul class=\"toc_list\">  <li class=\"first\">    <a href=\"#i-0\">params\u3068\u306f\uff1fRails\u958b\u767a\u8005\u304c\u77e5\u308b\u3079\u304d\u57fa\u672c\u6982\u5ff5<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-1\">HTTP\u30ea\u30af\u30a8\u30b9\u30c8\u3068\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u95a2\u4fc2\u6027<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-2\">Rails\u306b\u304a\u3051\u308bparams\u306e\u91cd\u8981\u6027<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-3\">Strong Parameters\uff1a\u5b89\u5168\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u51e6\u7406\u306e\u5b9f\u73fe<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-4\">Mass Assignment\u8106\u5f31\u6027\u3068\u306f<\/a>      <\/li>      <li>        <a href=\"#i-5\">permit()\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u305f\u8a31\u53ef\u30ea\u30b9\u30c8\u306e\u4f5c\u6210<\/a>      <\/li>      <li>        <a href=\"#i-6\">require()\u30e1\u30bd\u30c3\u30c9\u306b\u3088\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5fc5\u9808\u5316<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-7\">\u30cd\u30b9\u30c8\u3057\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u51e6\u7406<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-8\">\u8907\u96d1\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u3067\u306eparams\u306e\u6d3b\u7528\u6cd5<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-9\">\u30cd\u30b9\u30c8\u3055\u308c\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u51e6\u7406\u30c6\u30af\u30cb\u30c3\u30af<\/a>      <\/li>      <li>        <a href=\"#i-10\">\u914d\u5217\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u52b9\u7387\u7684\u306a\u6271\u3044\u65b9<\/a>      <\/li>      <li>        <a href=\"#i-11\">JSON\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u53d7\u3051\u53d6\u308a\u3068\u30d1\u30fc\u30b9<\/a>      <\/li>      <li>        <a href=\"#i-12\">\u8907\u96d1\u306a\u30d5\u30a9\u30fc\u30e0\u69cb\u9020\u3068\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u95a2\u4fc2<\/a>      <\/li>      <li>        <a href=\"#i-13\">\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u6b63\u898f\u5316\u3068\u5909\u63db<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-14\">\u307e\u3068\u3081<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-15\">params\u306b\u95a2\u9023\u3059\u308b\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-16\">\u5165\u529b\u5024\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3068\u30b5\u30cb\u30bf\u30a4\u30ba<\/a>      <\/li>      <li>        <a href=\"#i-19\">SQL\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u5bfe\u7b56\u3068params\u306e\u95a2\u4fc2<\/a>      <\/li>      <li>        <a href=\"#i-22\">CSRF\u30c8\u30fc\u30af\u30f3\u3068params\u306e\u9023\u643a<\/a>      <\/li>      <li>        <a href=\"#i-25\">Mass Assignment\u8106\u5f31\u6027\u306e\u518d\u78ba\u8a8d<\/a>      <\/li>      <li>        <a href=\"#i-26\">XSS\uff08\u30af\u30ed\u30b9\u30b5\u30a4\u30c8\u30b9\u30af\u30ea\u30d7\u30c6\u30a3\u30f3\u30b0\uff09\u653b\u6483\u306e\u9632\u6b62<\/a>      <\/li>      <li>        <a href=\"#i-29\">\u305d\u306e\u4ed6\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-35\">\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u306e\u9069\u7528<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-36\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\uff1aparams\u306e\u52b9\u7387\u7684\u306a\u5229\u7528<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-37\">\u4e0d\u8981\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0<\/a>      <\/li>      <li>        <a href=\"#i-38\">\u5927\u91cf\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u51e6\u7406\u6642\u306e\u6ce8\u610f\u70b9<\/a>      <\/li>      <li>        <a href=\"#i-39\">N+1\u30af\u30a8\u30ea\u554f\u984c\u3068params\u306e\u95a2\u9023\u6027<\/a>      <\/li>      <li>        <a href=\"#i-40\">\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30ad\u30e3\u30c3\u30b7\u30f3\u30b0\u6226\u7565<\/a>      <\/li>      <li>        <a href=\"#i-41\">\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30af\u30a8\u30ea\u306e\u6700\u9069\u5316\u3068params\u306e\u95a2\u4fc2<\/a>      <\/li>      <li>        <a href=\"#i-42\">\u30d0\u30eb\u30af\u30a4\u30f3\u30b5\u30fc\u30c8\/\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u6642\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u51e6\u7406<\/a>      <\/li>      <li>        <a href=\"#i-43\">\u30d1\u30e9\u30e1\u30fc\u30bf\u51e6\u7406\u306e\u30d7\u30ed\u30d5\u30a1\u30a4\u30ea\u30f3\u30b0\u3068\u5206\u6790<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-44\">\u975e\u540c\u671f\u51e6\u7406\u3092\u6d3b\u7528\u3057\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u51e6\u7406\u306e\u6700\u9069\u5316<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-45\">\u5b9f\u8df5\u7684\u306aparams\u306e\u4f7f\u7528\u4f8b\u3068\u5fdc\u7528\u30c6\u30af\u30cb\u30c3\u30af<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-46\">\u691c\u7d22\u6a5f\u80fd\u306e\u5b9f\u88c5\u306b\u304a\u3051\u308bparams\u306e\u6d3b\u7528<\/a>      <\/li>      <li>        <a href=\"#i-47\">\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u3068params\u306e\u9023\u643a<\/a>      <\/li>      <li>        <a href=\"#i-48\">API\u30d0\u30fc\u30b8\u30e7\u30cb\u30f3\u30b0\u306b\u304a\u3051\u308bparams\u306e\u5f79\u5272<\/a>      <\/li>      <li>        <a href=\"#i-49\">\u52d5\u7684\u306a\u30d5\u30a9\u30fc\u30e0\u751f\u6210\u3068params\u306e\u51e6\u7406<\/a>      <\/li>      <li>        <a href=\"#i-50\">\u8907\u6570\u30e2\u30c7\u30eb\u306e\u540c\u6642\u66f4\u65b0\u306b\u304a\u3051\u308bparams\u306e\u6d3b\u7528<\/a>      <\/li>      <li>        <a href=\"#i-51\">\u30d5\u30a1\u30a4\u30eb\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3068params\u306e\u95a2\u4fc2<\/a>      <\/li>      <li>        <a href=\"#i-52\">\u591a\u8a00\u8a9e\u5bfe\u5fdc\u30b5\u30a4\u30c8\u3067\u306elocale\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u6271\u3044\u65b9<\/a>      <\/li>      <li>        <a href=\"#i-53\">\u6761\u4ef6\u4ed8\u304d\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3068params\u306e\u9023\u643a<\/a>      <\/li>      <li>        <a href=\"#i-54\">\u30d1\u30e9\u30e1\u30fc\u30bf\u306b\u57fa\u3065\u3044\u305f\u52d5\u7684\u306a\u30af\u30a8\u30ea\u69cb\u7bc9<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-55\">\u307e\u3068\u3081<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-56\">params\u306e\u30c6\u30b9\u30c8\u6226\u7565\uff1a\u54c1\u8cea\u3068\u5b89\u5168\u6027\u306e\u78ba\u4fdd<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-57\">\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30b9\u30da\u30c3\u30af\u3067\u306eparams\u30c6\u30b9\u30c8\u624b\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-58\">\u5883\u754c\u5024\u30c6\u30b9\u30c8\u3068\u30d1\u30e9\u30e1\u30fc\u30bf\u51e6\u7406<\/a>      <\/li>      <li>        <a href=\"#i-59\">\u30e2\u30c3\u30af\u3068\u30b9\u30bf\u30d6\u3092\u4f7f\u3063\u305fparams\u306e\u30c6\u30b9\u30c8<\/a>      <\/li>      <li>        <a href=\"#i-60\">Strong Parameters\u306e\u30c6\u30b9\u30c8<\/a>      <\/li>      <li>        <a href=\"#i-61\">\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u95a2\u9023\u306eparams\u30c6\u30b9\u30c8<\/a>      <\/li>      <li>        <a href=\"#i-62\">\u7d71\u5408\u30c6\u30b9\u30c8\u3067\u306eparams\u306e\u6271\u3044<\/a>      <\/li>      <li>        <a href=\"#i-63\">\u307e\u3068\u3081<\/a>      <\/li>      <li>        <a href=\"#i-64\">\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u751f\u6210\u30c4\u30fc\u30eb\u3068params\u306e\u9023\u643a<\/a>      <\/li>      <li>        <a href=\"#i-65\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30c6\u30b9\u30c8\u3068params\u306e\u95a2\u4fc2<\/a>      <\/li>      <li>        <a href=\"#i-66\">\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u578b\u5909\u63db\u30c6\u30b9\u30c8<\/a>      <\/li>      <li>        <a href=\"#i-67\">\u56fd\u969b\u5316\uff08i18n\uff09\u306b\u95a2\u3059\u308bparams\u30c6\u30b9\u30c8<\/a>      <\/li>      <li>        <a href=\"#i-68\">\u30c6\u30b9\u30c8\u30ab\u30d0\u30ec\u30c3\u30b8\u306e\u78ba\u8a8d<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-69\">\u307e\u3068\u3081<\/a>      <\/li>    <\/ul>  <\/li>  <li class=\"last\">    <a href=\"#i-70\">\u307e\u3068\u3081\uff1aRuby on Rails params\u30de\u30b9\u30bf\u30fc\u3078\u306e\u9053<\/a>  <\/li><\/ul>\n      <a href=\"#\" class=\"sgb-toc-button js-toc-button\" rel=\"nofollow\" data-open-dialog=\"true\"><i class=\"fa fa-list\"><\/i><span class=\"sgb-toc-button__text\">\u76ee\u6b21\u3078<\/span><\/a>\n    <\/div><\/div><h2 class=\"wp-block-heading\" id=\"i-0\">params\u3068\u306f\uff1fRails\u958b\u767a\u8005\u304c\u77e5\u308b\u3079\u304d\u57fa\u672c\u6982\u5ff5<\/h2>\n\n\n\n<p>Ruby on Rails\u306b\u304a\u3044\u3066\u3001<code>params<\/code>\u306f\u958b\u767a\u8005\u304c\u5fc5\u305a\u7406\u89e3\u3057\u3066\u304a\u304f\u3079\u304d\u91cd\u8981\u306a\u6982\u5ff5\u306e\u4e00\u3064\u3067\u3059\u3002<br><code>params<\/code>\u306f\u3001HTTP\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u8868\u3059\u30cf\u30c3\u30b7\u30e5\u30e9\u30a4\u30af\u306a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5185\u3067\u30e6\u30fc\u30b6\u30fc\u304b\u3089\u306e\u5165\u529b\u30c7\u30fc\u30bf\u3092\u6271\u3046\u969b\u306b\u4e2d\u5fc3\u7684\u306a\u5f79\u5272\u3092\u679c\u305f\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-1\">HTTP\u30ea\u30af\u30a8\u30b9\u30c8\u3068\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u95a2\u4fc2\u6027<\/h3>\n\n\n\n<p>Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u30d6\u30e9\u30a6\u30b6\u3092\u901a\u3058\u3066\u30b5\u30fc\u30d0\u30fc\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u4fe1\u3057\u307e\u3059\u3002<br>\u3053\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u306f\u3001\u69d8\u3005\u306a\u5f62\u3067\u30c7\u30fc\u30bf\u304c\u542b\u307e\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>GET\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u30af\u30a8\u30ea\u6587\u5b57\u5217<\/li>\n\n\n\n<li>POST\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u30d5\u30a9\u30fc\u30e0\u30c7\u30fc\u30bf<\/li>\n\n\n\n<li>URL\u306b\u542b\u307e\u308c\u308b\u30d1\u30e9\u30e1\u30fc\u30bf<\/li>\n<\/ul>\n\n\n\n<p>Rails\u306f\u3001\u3053\u308c\u3089\u306e\u30c7\u30fc\u30bf\u3092\u81ea\u52d5\u7684\u306b\u89e3\u6790\u3057\u3001<code>params<\/code>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u3057\u3066\u307e\u3068\u3081\u3042\u3052\u307e\u3059\u3002<br>\u3053\u308c\u306b\u3088\u308a\u3001\u30c7\u30fc\u30bf\u306e\u51fa\u6240\u306b\u95a2\u308f\u3089\u305a\u3001\u7d71\u4e00\u3055\u308c\u305f\u65b9\u6cd5\u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-2\">Rails\u306b\u304a\u3051\u308bparams\u306e\u91cd\u8981\u6027<\/h3>\n\n\n\n<p><code>params<\/code>\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5834\u9762\u3067\u91cd\u8981\u306a\u5f79\u5272\u3092\u679c\u305f\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u306e\u51e6\u7406\uff1a\u30d5\u30a9\u30fc\u30e0\u304b\u3089\u306e\u30c7\u30fc\u30bf\u53d6\u5f97<\/li>\n\n\n\n<li>URL\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u89e3\u6790\uff1aRESTful\u306a\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3067\u306e\u30ea\u30bd\u30fc\u30b9\u8b58\u5225<\/li>\n\n\n\n<li>API\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\uff1a\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304b\u3089\u306e\u30c7\u30fc\u30bf\u53d7\u4fe1<\/li>\n<\/ol>\n\n\n\n<p><code>params<\/code>\u306e\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class UsersController &lt; ApplicationController\n  def show\n    @user = User.find(params[:id])\n    # params[:id]\u306fURL\u304b\u3089\u53d6\u5f97\u3055\u308c\u305f\u30e6\u30fc\u30b6\u30fcID\n  end\n\n  def create\n    @user = User.new(params[:user])\n    # params[:user]\u306f\u30d5\u30a9\u30fc\u30e0\u304b\u3089\u9001\u4fe1\u3055\u308c\u305f\u30e6\u30fc\u30b6\u30fc\u60c5\u5831\n  end\nend<\/pre>\n\n\n\n<p><code>params<\/code>\u306f\u6587\u5b57\u5217\u306e\u30ad\u30fc\u3092\u6301\u3064\u30cf\u30c3\u30b7\u30e5\u306e\u3088\u3046\u306b\u632f\u308b\u821e\u3044\u307e\u3059\u304c\u3001\u5b9f\u969b\u306b\u306fActionController::Parameters\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067\u3059\u3002<br>\u3053\u308c\u306b\u3088\u308a\u3001\u6587\u5b57\u5217\u30ad\u30fc\u3068\u30b7\u30f3\u30dc\u30eb\u30ad\u30fc\u306e\u4e21\u65b9\u3092\u4f7f\u3063\u3066\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u4fbf\u5229\u3055\u3068\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u6a5f\u80fd\u304c\u63d0\u4f9b\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \u4ee5\u4e0b\u306f\u540c\u3058\u5024\u306b\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\nparams['user_id']\nparams[:user_id]<\/pre>\n\n\n\n<p><code>params<\/code>\u306e\u5024\u306f\u5e38\u306b\u6587\u5b57\u5217\u578b\u3067\u3042\u308b\u3053\u3068\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002\u6570\u5024\u3084\u771f\u507d\u5024\u3092\u6271\u3046\u969b\u306f\u3001\u9069\u5207\u306a\u578b\u5909\u63db\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u767a\u3059\u308b\u4e0a\u3067\u3001<code>params<\/code>\u306e\u7406\u89e3\u306f\u4e0d\u53ef\u6b20\u3067\u3059\u3002<br>\u9069\u5207\u306b\u4f7f\u3044\u3053\u306a\u3059\u3053\u3068\u3067\u3001\u67d4\u8edf\u3067\u5b89\u5168\u306a\u30c7\u30fc\u30bf\u51e6\u7406\u304c\u53ef\u80fd\u306b\u306a\u308a\u3001\u30e6\u30fc\u30b6\u30fc\u30d5\u30ec\u30f3\u30c9\u30ea\u30fc\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u69cb\u7bc9\u306b\u3064\u306a\u304c\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-3\">Strong Parameters\uff1a\u5b89\u5168\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u51e6\u7406\u306e\u5b9f\u73fe<\/h2>\n\n\n\n<p>Ruby on Rails\u306b\u304a\u3044\u3066\u3001\u30e6\u30fc\u30b6\u30fc\u304b\u3089\u306e\u5165\u529b\u3092\u5b89\u5168\u306b\u51e6\u7406\u3059\u308b\u3053\u3068\u306f\u975e\u5e38\u306b\u91cd\u8981\u3067\u3059\u3002<br>Strong Parameters\u306f\u3001\u3053\u306e\u8ab2\u984c\u306b\u5bfe\u3059\u308bRails\u306e\u89e3\u6c7a\u7b56\u3067\u3042\u308a\u3001Mass Assignment\u8106\u5f31\u6027\u304b\u3089\u79c1\u305f\u3061\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5b88\u308b\u5f37\u529b\u306a\u6a5f\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-4\">Mass Assignment\u8106\u5f31\u6027\u3068\u306f<\/h3>\n\n\n\n<p>Mass Assignment\u8106\u5f31\u6027\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u4e88\u671f\u3057\u306a\u3044\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u9001\u4fe1\u3059\u308b\u3053\u3068\u3067\u3001\u30e2\u30c7\u30eb\u306e\u5c5e\u6027\u3092\u4e0d\u6b63\u306b\u5909\u66f4\u3067\u304d\u3066\u3057\u307e\u3046\u554f\u984c\u3067\u3059\u3002<br>\u4ee5\u4e0b\u306b\u4f8b\u3092\u8a18\u8f09\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \u8106\u5f31\u306a\u30b3\u30fc\u30c9\nUser.create(params[:user])<\/pre>\n\n\n\n<p>\u3053\u306e\u5834\u5408\u3001\u60aa\u610f\u306e\u3042\u308b\u30e6\u30fc\u30b6\u30fc\u304c <code>admin: true<\/code> \u306e\u3088\u3046\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u9001\u4fe1\u3059\u308b\u3068\u3001\u610f\u56f3\u305b\u305a\u7ba1\u7406\u8005\u6a29\u9650\u3092\u4ed8\u4e0e\u3057\u3066\u3057\u307e\u3046\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-5\">permit()\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u305f\u8a31\u53ef\u30ea\u30b9\u30c8\u306e\u4f5c\u6210<\/h3>\n\n\n\n<p>Strong Parameters\u306f\u3001<code>permit()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u660e\u793a\u7684\u306b\u8a31\u53ef\u3059\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u3053\u306e\u554f\u984c\u3092\u89e3\u6c7a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def user_params\n  params.require(:user).permit(:name, :email, :password)\nend\n\n# \u5b89\u5168\u306a\u30b3\u30fc\u30c9\n@user = User.create(user_params)<\/pre>\n\n\n\n<p>\u3053\u306e\u65b9\u6cd5\u3067\u306f\u3001<code>name<\/code>\u3001<code>email<\/code>\u3001<code>password<\/code>\u4ee5\u5916\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u81ea\u52d5\u7684\u306b\u9664\u5916\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-6\">require()\u30e1\u30bd\u30c3\u30c9\u306b\u3088\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5fc5\u9808\u5316<\/h3>\n\n\n\n<p><code>require()<\/code>\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u7279\u5b9a\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u5b58\u5728\u3059\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3001\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\u306f\u4f8b\u5916\u3092\u767a\u751f\u3055\u305b\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def create\n  @user = User.new(user_params)\n  if @user.save\n    redirect_to @user, notice: 'User was successfully created.'\n  else\n    render :new\n  end\nend\n\nprivate\n\ndef user_params\n  params.require(:user).permit(:name, :email, :password)\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u4f8b\u3067\u306f\u3001<code>params<\/code>\u306b<code>:user<\/code>\u30ad\u30fc\u304c\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\u3001<code>ActionController::ParameterMissing<\/code>\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-7\">\u30cd\u30b9\u30c8\u3057\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u51e6\u7406<\/h3>\n\n\n\n<p>\u3088\u308a\u8907\u96d1\u306a\u69cb\u9020\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3082\u3001Strong Parameters\u3067\u5b89\u5168\u306b\u51e6\u7406\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def article_params\n  params.require(:article).permit(:title, :content, tags: [], comments_attributes: [:id, :body, :_destroy])\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u4f8b\u3067\u306f\u3001\u8a18\u4e8b\u306e\u30bf\u30a4\u30c8\u30eb\u3068\u5185\u5bb9\u306b\u52a0\u3048\u3066\u3001\u30bf\u30b0\u306e\u914d\u5217\u3068\u30b3\u30e1\u30f3\u30c8\u306e\u5c5e\u6027\uff08id\u3068body\u3001\u304a\u3088\u3073\u524a\u9664\u30d5\u30e9\u30b0\uff09\u3092\u8a31\u53ef\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-sgb-block-simple sgb-box-simple sgb-box-simple--title-normal sgb-box-simple--with-border\"><div style=\"background-color:var(--wp--preset--color--sango-main);color:#FFF\" class=\"sgb-box-simple__title\">Strong Parameters\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u30104STEP\u3011<\/div><div class=\"sgb-box-simple__body\" style=\"border-color:var(--wp--preset--color--sango-main);background-color:#FFF\">\n<ol class=\"wp-block-list\">\n<li>\u30d1\u30e9\u30e1\u30fc\u30bf\u51e6\u7406\u30e1\u30bd\u30c3\u30c9\u3092<code>private<\/code>\u306b\u3059\u308b<\/li>\n\n\n\n<li>\u5fc5\u8981\u6700\u5c0f\u9650\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u307f\u3092\u8a31\u53ef\u3059\u308b<\/li>\n\n\n\n<li>\u30cd\u30b9\u30c8\u3057\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u9069\u5207\u306b\u51e6\u7406\u3059\u308b<\/li>\n\n\n\n<li>\u30ab\u30b9\u30bf\u30e0\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3068\u7d44\u307f\u5408\u308f\u305b\u3066\u4f7f\u7528\u3059\u308b<\/li>\n<\/ol>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-sgb-message\"><div class=\"memo sng-shadow-0\" style=\"border-radius:0px;background-color:#b4e0fa;color:#009EF3\"><div class=\"memo_ttl dfont\"><span class=\"sng-box-msg__icon\" style=\"background:#009EF3\"><i class=\"far fa-thumbs-up\"><\/i><\/span><div class=\"sng-box-msg__title\">Strong Parameters\u306e\u5229\u70b9<\/div><\/div><div class=\"sng-box-msg__contents\">\n<ul class=\"wp-block-list\">\n<li><strong>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u306e\u5411\u4e0a<\/strong>\uff1aMass Assignment\u8106\u5f31\u6027\u3092\u9632\u3050<\/li>\n\n\n\n<li><strong>\u30b3\u30fc\u30c9\u306e\u53ef\u8aad\u6027<\/strong>\uff1a\u8a31\u53ef\u3055\u308c\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u660e\u78ba\u306b\u306a\u308b<\/li>\n\n\n\n<li><strong>\u4fdd\u5b88\u6027<\/strong>\uff1a\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5909\u66f4\u304c\u4e00\u7b87\u6240\u3067\u7ba1\u7406\u3067\u304d\u308b<\/li>\n<\/ul>\n<\/div><\/div><\/div>\n\n\n\n<div class=\"wp-block-sgb-message\"><div class=\"memo sng-shadow-0\" style=\"border-radius:0px;background-color:#ffebeb;color:#f88080\"><div class=\"memo_ttl dfont\"><span class=\"sng-box-msg__icon\" style=\"background:#f88080\"><i class=\"fas fa-exclamation\"><\/i><\/span><div class=\"sng-box-msg__title\">Strong Parameters\u306e\u6ce8\u610f\u70b9<\/div><\/div><div class=\"sng-box-msg__contents\">\n<ul class=\"wp-block-list\">\n<li>\u904e\u5ea6\u306b\u5236\u9650\u7684\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u8a2d\u5b9a\u306f\u3001\u6a5f\u80fd\u306e\u5236\u9650\u306b\u3064\u306a\u304c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b<\/li>\n\n\n\n<li>\u8907\u96d1\u306a\u30d5\u30a9\u30fc\u30e0\u3067\u306f\u3001\u30cd\u30b9\u30c8\u3055\u308c\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u8a2d\u5b9a\u304c\u7169\u96d1\u306b\u306a\u308b\u3053\u3068\u304c\u3042\u308b<\/li>\n<\/ul>\n<\/div><\/div><\/div>\n\n\n\n<p>Strong Parameters\u3092\u9069\u5207\u306b\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3092\u5927\u5e45\u306b\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br>\u3053\u308c\u306f\u3001\u30e2\u30c0\u30f3\u306aRails\u958b\u767a\u306b\u304a\u3044\u3066\u5fc5\u9808\u306e\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3067\u3042\u308a\u3001\u3059\u3079\u3066\u306e\u958b\u767a\u8005\u304c\u7fd2\u5f97\u3059\u3079\u304d\u91cd\u8981\u306a\u30b9\u30ad\u30eb\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-8\">\u8907\u96d1\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u3067\u306eparams\u306e\u6d3b\u7528\u6cd5<\/h2>\n\n\n\n<p>\u5b9f\u969b\u306eWeb\u958b\u767a\u3067\u306f\u3001\u5358\u7d14\u306a\u30d5\u30a9\u30fc\u30e0\u30c7\u30fc\u30bf\u3060\u3051\u3067\u306a\u304f\u3001\u8907\u96d1\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u3092\u6271\u3046\u3053\u3068\u304c\u3088\u304f\u3042\u308a\u307e\u3059\u3002<br>\u3053\u3053\u3067\u306f\u3001Ruby on Rails\u306b\u304a\u3051\u308b\u8907\u96d1\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u51e6\u7406\u306b\u3064\u3044\u3066\u3001\u8a73\u3057\u304f\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-9\">\u30cd\u30b9\u30c8\u3055\u308c\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u51e6\u7406\u30c6\u30af\u30cb\u30c3\u30af<\/h3>\n\n\n\n<p>\u30cd\u30b9\u30c8\u3055\u308c\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u3001\u95a2\u9023\u3059\u308b\u30c7\u30fc\u30bf\u3092\u968e\u5c64\u7684\u306b\u8868\u73fe\u3059\u308b\u969b\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002<br>\u4f8b\u3048\u3070\u3001\u30e6\u30fc\u30b6\u30fc\u3068\u305d\u306e\u4f4f\u6240\u60c5\u5831\u3092\u540c\u6642\u306b\u51e6\u7406\u3059\u308b\u5834\u5408<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def user_params\n  params.require(:user).permit(:name, :email, address: [:street, :city, :country])\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306bStrong Parameters\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u69cb\u9020\u3092\u5b89\u5168\u306b\u51e6\u7406\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n  user: {\n    name: \"John Doe\",\n    email: \"john@example.com\",\n    address: {\n      street: \"123 Main St\",\n      city: \"New York\",\n      country: \"USA\"\n    }\n  }\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-10\">\u914d\u5217\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u52b9\u7387\u7684\u306a\u6271\u3044\u65b9<\/h3>\n\n\n\n<p>\u914d\u5217\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u3001\u8907\u6570\u306e\u540c\u7a2e\u306e\u30c7\u30fc\u30bf\u3092\u4e00\u5ea6\u306b\u51e6\u7406\u3059\u308b\u969b\u306b\u4fbf\u5229\u3067\u3059\u3002<br>\u4f8b\u3048\u3070\u3001\u8907\u6570\u306e\u30bf\u30b0\u3092\u6301\u3064\u8a18\u4e8b\u3092\u4f5c\u6210\u3059\u308b\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def article_params\n  params.require(:article).permit(:title, :content, tags: [])\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306b\u3059\u308b\u3053\u3068\u3067\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u69cb\u9020\u3092\u51e6\u7406\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n  article: {\n    title: \"Ruby on Rails Tips\",\n    content: \"Here are some useful tips...\",\n    tags: [\"ruby\", \"rails\", \"web development\"]\n  }\n}<\/pre>\n\n\n\n<p>\u914d\u5217\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u51e6\u7406\u3059\u308b\u969b\u306f\u3001\u7a7a\u306e\u8981\u7d20\u3092\u81ea\u52d5\u7684\u306b\u9664\u5916\u3059\u308b<code>reject(&amp;:blank?)<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3068\u4fbf\u5229\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def create\n  @article = Article.new(article_params)\n  @article.tags = params[:article][:tags].reject(&amp;:blank?) if params[:article][:tags]\n  # \u4fdd\u5b58\u51e6\u7406\nend<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-11\">JSON\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u53d7\u3051\u53d6\u308a\u3068\u30d1\u30fc\u30b9<\/h3>\n\n\n\n<p>API\u306e\u958b\u767a\u3067\u306f\u3001JSON\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306e\u30c7\u30fc\u30bf\u3092\u6271\u3046\u3053\u3068\u304c\u591a\u304f\u3042\u308a\u307e\u3059\u3002Rails\u306f\u81ea\u52d5\u7684\u306bJSON\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u30d1\u30fc\u30b9\u3057\u307e\u3059\u304c\u3001\u660e\u793a\u7684\u306b\u51e6\u7406\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def api_action\n  data = JSON.parse(request.body.read)\n  # \u30c7\u30fc\u30bf\u51e6\u7406\nrescue JSON::ParserError\n  render json: { error: 'Invalid JSON' }, status: :bad_request\nend<\/pre>\n\n\n\n<p>\u307e\u305f\u3001JSON\u30c7\u30fc\u30bf\u3092\u542b\u3080\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u8a31\u53ef\u3059\u308b\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def api_params\n  params.require(:api_data).permit!\nend<\/pre>\n\n\n\n<p>\u305f\u3060\u3057\u3001<code>permit!<\/code>\u306f\u5168\u3066\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u8a31\u53ef\u3059\u308b\u305f\u3081\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u4e0a\u306e\u30ea\u30b9\u30af\u304c\u3042\u308a\u307e\u3059\u3002<br>\u53ef\u80fd\u306a\u9650\u308a\u3001\u8a31\u53ef\u3059\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u660e\u793a\u7684\u306b\u6307\u5b9a\u3059\u308b\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-12\">\u8907\u96d1\u306a\u30d5\u30a9\u30fc\u30e0\u69cb\u9020\u3068\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u95a2\u4fc2<\/h3>\n\n\n\n<p><code>accepts_nested_attributes_for<\/code>\u3092\u4f7f\u7528\u3057\u3066\u95a2\u9023\u30e2\u30c7\u30eb\u3092\u540c\u6642\u306b\u66f4\u65b0\u3059\u308b\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class Project &lt; ApplicationRecord\n  has_many :tasks\n  accepts_nested_attributes_for :tasks, allow_destroy: true\nend\n\nclass ProjectsController &lt; ApplicationController\n  def project_params\n    params.require(:project).permit(:name, tasks_attributes: [:id, :name, :_destroy])\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306b\u3059\u308b\u3053\u3068\u3067\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3068\u305d\u306e\u30bf\u30b9\u30af\u3092\u540c\u6642\u306b\u4f5c\u6210\u30fb\u66f4\u65b0\u30fb\u524a\u9664\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-13\">\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u6b63\u898f\u5316\u3068\u5909\u63db<\/h3>\n\n\n\n<p>\u8907\u96d1\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6271\u3046\u969b\u306f\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3067\u30c7\u30fc\u30bf\u3092\u6b63\u898f\u5316\u307e\u305f\u306f\u5909\u63db\u3059\u308b\u3053\u3068\u304c\u6709\u52b9\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def create\n  @user = User.new(user_params)\n  @user.username = params[:user][:email].split('@').first if params[:user][:email]\n  # \u4fdd\u5b58\u51e6\u7406\nend<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-14\">\u307e\u3068\u3081<\/h3>\n\n\n\n<p>\u8907\u96d1\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u3092\u6271\u3046\u969b\u306f\u3001\u4ee5\u4e0b\u306e\u70b9\u306b\u6ce8\u610f\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<div class=\"wp-block-sgb-block-simple sgb-box-simple sgb-box-simple--title-normal sgb-box-simple--with-border\"><div style=\"background-color:var(--wp--preset--color--sango-main);color:#FFF\" class=\"sgb-box-simple__title\">\u8907\u96d1\u306a\u30c7\u30fc\u30bf\u3067params\u3092\u4f7f\u7528\u3059\u308b\u969b\u306e5\u3064\u306e\u6ce8\u610f\u70b9<\/div><div class=\"sgb-box-simple__body\" style=\"border-color:var(--wp--preset--color--sango-main);background-color:#FFF\">\n<ol class=\"wp-block-list\">\n<li>\u30cd\u30b9\u30c8\u3055\u308c\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u3084\u914d\u5217\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u9069\u5207\u306b\u8a31\u53ef\u3059\u308b<\/li>\n\n\n\n<li>JSON\u30c7\u30fc\u30bf\u3092\u5b89\u5168\u306b\u30d1\u30fc\u30b9\u3057\u51e6\u7406\u3059\u308b<\/li>\n\n\n\n<li>\u95a2\u9023\u30e2\u30c7\u30eb\u306e\u30c7\u30fc\u30bf\u3092\u52b9\u7387\u7684\u306b\u51e6\u7406\u3059\u308b<\/li>\n\n\n\n<li>\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u6b63\u898f\u5316\u3084\u5909\u63db\u3092\u9069\u5207\u306b\u884c\u3046<\/li>\n\n\n\n<li>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3092\u5e38\u306b\u610f\u8b58\u3057\u3001\u5fc5\u8981\u6700\u5c0f\u9650\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u307f\u3092\u8a31\u53ef\u3059\u308b<\/li>\n<\/ol>\n<\/div><\/div>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u30c6\u30af\u30cb\u30c3\u30af\u3092\u7fd2\u5f97\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u67d4\u8edf\u3067\u5805\u7262\u306aRails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u767a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-15\">params\u306b\u95a2\u9023\u3059\u308b\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/h2>\n\n\n\n<p>Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u304a\u3044\u3066\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u306f\u6700\u3082\u91cd\u8981\u306a\u8003\u616e\u4e8b\u9805\u306e\u4e00\u3064\u3067\u3059\u3002<br>\u7279\u306b\u3001\u30e6\u30fc\u30b6\u30fc\u304b\u3089\u306e\u5165\u529b\u3092\u6271\u3046<code>params<\/code>\u306f\u3001\u591a\u304f\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30ea\u30b9\u30af\u306e\u6e90\u3068\u306a\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<br>\u3053\u3053\u3067\u306f\u3001Ruby on Rails\u306b\u304a\u3051\u308b<code>params<\/code>\u306b\u95a2\u9023\u3059\u308b\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u8a73\u3057\u304f\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-16\">\u5165\u529b\u5024\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3068\u30b5\u30cb\u30bf\u30a4\u30ba<\/h3>\n\n\n\n<p>\u30e6\u30fc\u30b6\u30fc\u304b\u3089\u306e\u5165\u529b\u306f\u5e38\u306b\u4fe1\u983c\u3067\u304d\u306a\u3044\u3082\u306e\u3068\u3057\u3066\u6271\u3044\u3001\u9069\u5207\u306b\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3068\u30b5\u30cb\u30bf\u30a4\u30ba\u3092\u884c\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-17\">1. \u30e2\u30c7\u30eb\u30ec\u30d9\u30eb\u3067\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class User &lt; ApplicationRecord\n  validates :email, presence: true, format: { with: URI::MailTo::EMAIL_REGEXP }\n  validates :username, presence: true, length: { minimum: 3, maximum: 20 }\nend<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-18\">2. \u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30b5\u30cb\u30bf\u30a4\u30ba<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class ApplicationController &lt; ActionController::Base\n  before_action :sanitize_params\n\n  private\n\n  def sanitize_params\n    params.each do |key, value|\n      params[key] = sanitize_input(value) if value.is_a?(String)\n    end\n  end\n\n  def sanitize_input(input)\n    ActionController::Base.helpers.sanitize(input)\n  end\nend<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-19\">SQL\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u5bfe\u7b56\u3068params\u306e\u95a2\u4fc2<\/h3>\n\n\n\n<p>SQL\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u653b\u6483\u306f\u3001\u60aa\u610f\u306e\u3042\u308bSQL\u30b3\u30fc\u30c9\u3092\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u633f\u5165\u3059\u308b\u3053\u3068\u3067\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4e0d\u6b63\u306b\u64cd\u4f5c\u3059\u308b\u653b\u6483\u3067\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-20\">1. \u30d7\u30ec\u30fc\u30b9\u30db\u30eb\u30c0\u306e\u4f7f\u7528<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">User.where(\"name = ? AND email = ?\", params[:name], params[:email])<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-21\">2. Active Record\u306e\u30e1\u30bd\u30c3\u30c9\u30c1\u30a7\u30fc\u30f3Rails 6\u304b\u3089\u306f\u3001\u30ad\u30fc\u3068\u306f\u5225\u306e\u5f15\u6570\u3067\u306e\u307f\u30d7\u30ec\u30fc\u30b9\u30db\u30eb\u30c0\u304c\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">User.where(name: params[:name]).where(\"email = ?\", params[:email])<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-22\">CSRF\u30c8\u30fc\u30af\u30f3\u3068params\u306e\u9023\u643a<\/h3>\n\n\n\n<p>\u30af\u30ed\u30b9\u30b5\u30a4\u30c8\u30ea\u30af\u30a8\u30b9\u30c8\u30d5\u30a9\u30fc\u30b8\u30a7\u30ea\uff08CSRF\uff09\u653b\u6483\u3092\u9632\u3050\u305f\u3081\u306b\u3001Rails\u306fCSRF\u30c8\u30fc\u30af\u30f3\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-23\">1. \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3067\u306e\u8a2d\u5b9a<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class ApplicationController &lt; ActionController::Base\n  protect_from_forgery with: :exception\nend<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-24\">2. \u30d5\u30a9\u30fc\u30e0\u3067\u306eCSRF\u30c8\u30fc\u30af\u30f3\u306e\u4f7f\u7528:<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;%= form_with(model: @user, local: true) do |form| %&gt;\n  &lt;%= form.text_field :name %&gt;\n  &lt;%= form.submit %&gt;\n&lt;% end %&gt;<\/pre>\n\n\n\n<p>Rails\u306f\u81ea\u52d5\u7684\u306bCSRF\u30c8\u30fc\u30af\u30f3\u3092\u30d5\u30a9\u30fc\u30e0\u306b\u633f\u5165\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-25\">Mass Assignment\u8106\u5f31\u6027\u306e\u518d\u78ba\u8a8d<\/h3>\n\n\n\n<p>Strong Parameters\u3092\u4f7f\u7528\u3057\u3066\u3001\u8a31\u53ef\u3055\u308c\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u307f\u3092\u53d7\u3051\u5165\u308c\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class UsersController &lt; ApplicationController\n  def create\n    @user = User.new(user_params)\n    # \u4fdd\u5b58\u51e6\u7406\n  end\n\n  private\n\n  def user_params\n    params.require(:user).permit(:name, :email, :password)\n  end\nend<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-26\">XSS\uff08\u30af\u30ed\u30b9\u30b5\u30a4\u30c8\u30b9\u30af\u30ea\u30d7\u30c6\u30a3\u30f3\u30b0\uff09\u653b\u6483\u306e\u9632\u6b62<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-27\">1. \u30d3\u30e5\u30fc\u3067\u306e\u81ea\u52d5\u30a8\u30b9\u30b1\u30fc\u30d7<\/h4>\n\n\n\n<p>Rails\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u30d3\u30e5\u30fc\u3067\u306e\u51fa\u529b\u3092\u81ea\u52d5\u30a8\u30b9\u30b1\u30fc\u30d7\u3057\u307e\u3059\u3002raw\u51fa\u529b\u3092\u907f\u3051\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-28\">2. Content Security Policy (CSP)\u306e\u8a2d\u5b9a<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># config\/initializers\/content_security_policy.rb\nRails.application.config.content_security_policy do |policy|\n  policy.default_src :self, :https\n  policy.font_src    :self, :https, :data\n  policy.img_src     :self, :https, :data\n  policy.object_src  :none\n  policy.script_src  :self, :https\n  policy.style_src   :self, :https\n  # \u5fc5\u8981\u306b\u5fdc\u3058\u3066\u4ed6\u306e\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3092\u8a2d\u5b9a\nend<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-29\">\u305d\u306e\u4ed6\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-30\">1. \u30bb\u30c3\u30b7\u30e7\u30f3\u30cf\u30a4\u30b8\u30e3\u30c3\u30af\u5bfe\u7b56<\/h4>\n\n\n\n<p>\u30bb\u30c3\u30b7\u30e7\u30f3ID\u3092\u9069\u5207\u306b\u7ba1\u7406\u3057\u3001\u30bb\u30c3\u30b7\u30e7\u30f3\u30cf\u30a4\u30b8\u30e3\u30c3\u30af\u306e\u30ea\u30b9\u30af\u3092\u8efd\u6e1b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">   # config\/initializers\/session_store.rb\n   Rails.application.config.session_store :cookie_store, key: '_your_app_session', secure: Rails.env.production?, httponly: true<\/pre>\n\n\n\n<p>\u3053\u306e\u8a2d\u5b9a\u306b\u3088\u308a\u3001\u30bb\u30c3\u30b7\u30e7\u30f3\u30af\u30c3\u30ad\u30fc\u306fHTTPS\u63a5\u7d9a\u3067\u306e\u307f\u9001\u4fe1\u3055\u308c\uff08\u672c\u756a\u74b0\u5883\uff09\u3001JavaScript\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-31\">2. \u30c7\u30d0\u30c3\u30b0\u60c5\u5831\u306e\u9069\u5207\u306a\u5236\u5fa1<\/h4>\n\n\n\n<p>\u672c\u756a\u74b0\u5883\u3067\u306f\u8a73\u7d30\u306a\u30a8\u30e9\u30fc\u60c5\u5831\u3092\u8868\u793a\u3057\u306a\u3044\u3088\u3046\u306b\u3057\u3001\u6f5c\u5728\u7684\u306a\u8106\u5f31\u6027\u306e\u9732\u51fa\u3092\u9632\u304e\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">   # config\/environments\/production.rb\n   config.consider_all_requests_local = false\n   config.action_dispatch.show_exceptions = false<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-32\">3. \u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u6697\u53f7\u5316\u3068\u5fa9\u53f7\u5316<\/h4>\n\n\n\n<p>\u6a5f\u5bc6\u6027\u306e\u9ad8\u3044\u30c7\u30fc\u30bf\u3092<code>params<\/code>\u3067\u9001\u4fe1\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\u306f\u3001\u6697\u53f7\u5316\u3092\u691c\u8a0e\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">   class ApplicationController &lt; ActionController::Base\n     def encrypt_param(value)\n       crypt = ActiveSupport::MessageEncryptor.new(Rails.application.credentials.secret_key_base[0..31])\n       crypt.encrypt_and_sign(value)\n     end\n\n     def decrypt_param(value)\n       crypt = ActiveSupport::MessageEncryptor.new(Rails.application.credentials.secret_key_base[0..31])\n       crypt.decrypt_and_verify(value)\n     end\n   end<\/pre>\n\n\n\n<p>\u4f7f\u7528\u4f8b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">   class UsersController &lt; ApplicationController\n     def update\n       user_id = decrypt_param(params[:encrypted_user_id])\n       @user = User.find(user_id)\n       # \u66f4\u65b0\u51e6\u7406\n     end\n   end<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-33\">4. \u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30b5\u30a4\u30ba\u5236\u9650<\/h4>\n\n\n\n<p>\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u542b\u3080\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u3088\u308bDoS\u653b\u6483\u3092\u9632\u3050\u305f\u3081\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30b5\u30a4\u30ba\u306b\u5236\u9650\u3092\u8a2d\u3051\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">   # config\/initializers\/rack_attack.rb\n   class Rack::Attack\n     Rack::Attack.parse_redis_url(ENV[\"REDIS_URL\"]) if ENV[\"REDIS_URL\"]\n\n     throttle('req\/ip', limit: 300, period: 5.minutes) do |req|\n       req.ip\n     end\n\n     Rack::Attack.throttled_response = lambda do |env|\n       [ 429, {}, ['\u30ea\u30af\u30a8\u30b9\u30c8\u56de\u6570\u304c\u5236\u9650\u3092\u8d85\u3048\u307e\u3057\u305f\u3002\u3057\u3070\u3089\u304f\u5f85\u3063\u3066\u304b\u3089\u518d\u8a66\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002']]\n     end\n   end<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-34\">5. \u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u578b\u30c1\u30a7\u30c3\u30af<\/h4>\n\n\n\n<p>\u4e88\u671f\u3057\u306a\u3044\u578b\u306e\u30c7\u30fc\u30bf\u304c\u9001\u4fe1\u3055\u308c\u308b\u3053\u3068\u3092\u9632\u3050\u305f\u3081\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u578b\u3092\u660e\u793a\u7684\u306b\u30c1\u30a7\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">   def process_data\n     return render json: { error: '\u7121\u52b9\u306a\u30d1\u30e9\u30e1\u30fc\u30bf' }, status: :bad_request unless params[:count].is_a?(String) &amp;&amp; params[:count].match?(\/\\A\\d+\\z\/)\n\n     count = params[:count].to_i\n     # \u51e6\u7406\u3092\u7d9a\u884c\n   end<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-35\">\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u306e\u9069\u7528<\/h3>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u9069\u7528\u3059\u308b\u969b\u306f\u3001\u4ee5\u4e0b\u306e\u70b9\u306b\u6ce8\u610f\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<div class=\"wp-block-sgb-block-simple sgb-box-simple sgb-box-simple--title-normal sgb-box-simple--with-border\"><div style=\"background-color:var(--wp--preset--color--sango-main);color:#FFF\" class=\"sgb-box-simple__title\">\u30bb\u30ad\u30ea\u30c6\u30a3\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u5b9f\u88c5\u3059\u308b\u969b\u306e5\u3064\u306e\u6ce8\u610f\u70b9<\/div><div class=\"sgb-box-simple__body\" style=\"border-color:var(--wp--preset--color--sango-main);background-color:#FFF\">\n<ol class=\"wp-block-list\">\n<li>\u5b9a\u671f\u7684\u306a\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u76e3\u67fb: \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3092\u5b9a\u671f\u7684\u306b\u898b\u76f4\u3057\u3001\u65b0\u305f\u306a\u8106\u5f31\u6027\u304c\u306a\u3044\u304b\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li>\u4f9d\u5b58\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u6700\u65b0\u5316: \u4f7f\u7528\u3057\u3066\u3044\u308bgem\u3084\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u6700\u65b0\u306e\u72b6\u614b\u306b\u4fdd\u3061\u3001\u65e2\u77e5\u306e\u8106\u5f31\u6027\u3092\u56de\u907f\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0: \u958b\u767a\u30c1\u30fc\u30e0\u5168\u4f53\u3067\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u610f\u8b58\u3092\u9ad8\u3081\u3001\u6700\u65b0\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u5b66\u3073\u7d9a\u3051\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002<\/li>\n\n\n\n<li>\u591a\u5c64\u9632\u5fa1: \u5358\u4e00\u306e\u5bfe\u7b56\u306b\u983c\u3089\u305a\u3001\u8907\u6570\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5c64\u3092\u8a2d\u3051\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u5805\u7262\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li>\u30ed\u30b0\u306e\u9069\u5207\u306a\u7ba1\u7406: \u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u95a2\u9023\u306e\u30a4\u30d9\u30f3\u30c8\u3092\u9069\u5207\u306b\u30ed\u30b0\u306b\u8a18\u9332\u3057\u3001\u554f\u984c\u304c\u767a\u751f\u3057\u305f\u969b\u306b\u8fc5\u901f\u306b\u5bfe\u5fdc\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/li>\n<\/ol>\n<\/div><\/div>\n\n\n\n<p><code>params<\/code>\u306b\u95a2\u9023\u3059\u308b\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u9069\u5207\u306b\u5b9f\u88c5\u3059\u308b\u3053\u3068\u3067\u3001Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3092\u5927\u5e45\u306b\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br>\u5e38\u306b\u6700\u65b0\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u60c5\u5831\u306b\u6ce8\u610f\u3092\u6255\u3044\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u7d99\u7d9a\u7684\u306b\u6539\u5584\u3057\u3066\u3044\u304f\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-36\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\uff1aparams\u306e\u52b9\u7387\u7684\u306a\u5229\u7528<\/h2>\n\n\n\n<p>Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u6700\u9069\u5316\u3059\u308b\u4e0a\u3067\u3001<code>params<\/code>\u306e\u52b9\u7387\u7684\u306a\u5229\u7528\u306f\u975e\u5e38\u306b\u91cd\u8981\u3067\u3059\u3002<br>\u9069\u5207\u306b\u5b9f\u88c5\u3059\u308b\u3053\u3068\u3067\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u5fdc\u7b54\u6027\u3092\u5411\u4e0a\u3055\u305b\u3001\u30ea\u30bd\u30fc\u30b9\u4f7f\u7528\u91cf\u3092\u524a\u6e1b\u3067\u304d\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u3001<code>params<\/code>\u306b\u95a2\u9023\u3059\u308b\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u30c6\u30af\u30cb\u30c3\u30af\u3092\u8a73\u3057\u304f\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-37\">\u4e0d\u8981\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0<\/h3>\n\n\n\n<p>\u4e0d\u8981\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u65e9\u3044\u6bb5\u968e\u3067\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3059\u308b\u3053\u3068\u3067\u3001\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u524a\u6e1b\u3057\u3001\u5f8c\u7d9a\u306e\u51e6\u7406\u3092\u52b9\u7387\u5316\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class ApplicationController &lt; ActionController::Base\n  before_action :filter_params\n\n  private\n\n  def filter_params\n    allowed_params = %w[id name email]\n    params.slice!(*allowed_params)\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u65b9\u6cd5\u306b\u3088\u308a\u3001\u8a31\u53ef\u3055\u308c\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u307f\u304c subsequent \u306e\u51e6\u7406\u306b\u6e21\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-38\">\u5927\u91cf\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u51e6\u7406\u6642\u306e\u6ce8\u610f\u70b9<\/h3>\n\n\n\n<p>\u5927\u91cf\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u51e6\u7406\u3059\u308b\u969b\u306f\u3001\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<br>\u30d0\u30c3\u30c1\u51e6\u7406\u3084\u5206\u5272\u51e6\u7406\u3092\u691c\u8a0e\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def bulk_update\n  User.transaction do\n    params[:users].each_slice(100) do |user_batch|\n      User.update(user_batch.map { |u| [u[:id], u.slice(:name, :email)] }.to_h)\n    end\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u4f8b\u3067\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u3092100\u4ef6\u305a\u3064\u306e\u30d0\u30c3\u30c1\u306b\u5206\u5272\u3057\u3066\u51e6\u7406\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-39\">N+1\u30af\u30a8\u30ea\u554f\u984c\u3068params\u306e\u95a2\u9023\u6027<\/h3>\n\n\n\n<p>N+1\u30af\u30a8\u30ea\u554f\u984c\u306f\u3001<code>params<\/code>\u3092\u4f7f\u7528\u3057\u3066\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30af\u30a8\u30ea\u3092\u751f\u6210\u3059\u308b\u969b\u306b\u3088\u304f\u767a\u751f\u3057\u307e\u3059\u3002<br><code>includes<\/code>\u3092\u4f7f\u7528\u3057\u3066\u3001\u95a2\u9023\u30c7\u30fc\u30bf\u3092\u4e8b\u524d\u306b\u8aad\u307f\u8fbc\u3080\u3053\u3068\u3067\u89e3\u6c7a\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def index\n  @posts = Post.includes(:author, :comments).where(category: params[:category])\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u65b9\u6cd5\u306b\u3088\u308a\u3001\u6295\u7a3f\u3001\u8457\u8005\u3001\u30b3\u30e1\u30f3\u30c8\u30921\u56de\u306e\u30af\u30a8\u30ea\u3067\u53d6\u5f97\u3067\u304d\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u5927\u5e45\u306b\u5411\u4e0a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-40\">\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30ad\u30e3\u30c3\u30b7\u30f3\u30b0\u6226\u7565<\/h3>\n\n\n\n<p>\u983b\u7e41\u306b\u4f7f\u7528\u3055\u308c\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u3084\u305d\u306e\u7d50\u679c\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3059\u308b\u3053\u3068\u3067\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def show\n  @user = Rails.cache.fetch(\"user_#{params[:id]}\", expires_in: 1.hour) do\n    User.find(params[:id])\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u4f8b\u3067\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u60c5\u5831\u30921\u6642\u9593\u30ad\u30e3\u30c3\u30b7\u30e5\u3057\u3001\u540c\u3058<code>params[:id]<\/code>\u306b\u5bfe\u3059\u308b\u5f8c\u7d9a\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9ad8\u901f\u5316\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-41\">\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30af\u30a8\u30ea\u306e\u6700\u9069\u5316\u3068params\u306e\u95a2\u4fc2<\/h3>\n\n\n\n<p><code>params<\/code>\u3092\u4f7f\u7528\u3057\u3066\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30af\u30a8\u30ea\u3092\u69cb\u7bc9\u3059\u308b\u969b\u306f\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u4f7f\u7528\u3092\u610f\u8b58\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class User &lt; ApplicationRecord\n  scope :search, -&gt;(query) { where(\"name LIKE ? OR email LIKE ?\", \"%#{query}%\", \"%#{query}%\") }\nend\n\nclass UsersController &lt; ApplicationController\n  def index\n    @users = User.search(params[:query]).limit(20)\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u4f8b\u3067\u306f\u3001<code>name<\/code>\u3068<code>email<\/code>\u30ab\u30e9\u30e0\u306b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3067\u3001\u691c\u7d22\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-42\">\u30d0\u30eb\u30af\u30a4\u30f3\u30b5\u30fc\u30c8\/\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u6642\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u51e6\u7406<\/h3>\n\n\n\n<p>\u5927\u91cf\u306e\u30ec\u30b3\u30fc\u30c9\u3092\u633f\u5165\u307e\u305f\u306f\u66f4\u65b0\u3059\u308b\u969b\u306f\u3001\u30d0\u30eb\u30af\u64cd\u4f5c\u3092\u4f7f\u7528\u3057\u3066\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u5411\u4e0a\u3055\u305b\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def bulk_create\n  users = params[:users].map do |user_params|\n    User.new(user_params.permit(:name, :email))\n  end\n  User.import users, validate: false\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u4f8b\u3067\u306f\u3001<code>activerecord-import<\/code> gem\u3092\u4f7f\u7528\u3057\u3066\u3001\u8907\u6570\u306e\u30e6\u30fc\u30b6\u30fc\u3092\u4e00\u5ea6\u306b\u633f\u5165\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-43\">\u30d1\u30e9\u30e1\u30fc\u30bf\u51e6\u7406\u306e\u30d7\u30ed\u30d5\u30a1\u30a4\u30ea\u30f3\u30b0\u3068\u5206\u6790<\/h3>\n\n\n\n<p>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u554f\u984c\u3092\u7279\u5b9a\u3059\u308b\u305f\u3081\u306b\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u51e6\u7406\u306e\u30d7\u30ed\u30d5\u30a1\u30a4\u30ea\u30f3\u30b0\u3092\u884c\u3044\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def process_data\n  Benchmark.ms do\n    # \u30d1\u30e9\u30e1\u30fc\u30bf\u51e6\u7406\u306e\u30b3\u30fc\u30c9\n  end\nend<\/pre>\n\n\n\n<p><code>rack-mini-profiler<\/code> gem\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u3088\u308a\u8a73\u7d30\u306a\u30d7\u30ed\u30d5\u30a1\u30a4\u30ea\u30f3\u30b0\u60c5\u5831\u3092\u5f97\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-44\">\u975e\u540c\u671f\u51e6\u7406\u3092\u6d3b\u7528\u3057\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u51e6\u7406\u306e\u6700\u9069\u5316<\/h3>\n\n\n\n<p>\u6642\u9593\u306e\u304b\u304b\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u51e6\u7406\u306f\u3001\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u30b8\u30e7\u30d6\u3068\u3057\u3066\u975e\u540c\u671f\u306b\u5b9f\u884c\u3059\u308b\u3053\u3068\u3067\u3001\u30ec\u30b9\u30dd\u30f3\u30b9\u6642\u9593\u3092\u77ed\u7e2e\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class DataProcessingJob &lt; ApplicationJob\n  queue_as :default\n\n  def perform(params)\n    # \u6642\u9593\u306e\u304b\u304b\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u51e6\u7406\n  end\nend\n\nclass DataController &lt; ApplicationController\n  def process\n    DataProcessingJob.perform_later(params.to_h)\n    redirect_to root_path, notice: '\u51e6\u7406\u3092\u958b\u59cb\u3057\u307e\u3057\u305f'\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u65b9\u6cd5\u306b\u3088\u308a\u3001\u30e6\u30fc\u30b6\u30fc\u306f\u3059\u3050\u306b\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u53d7\u3051\u53d6\u308a\u3001\u9577\u6642\u9593\u306e\u51e6\u7406\u306f\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u30c6\u30af\u30cb\u30c3\u30af\u3092\u9069\u5207\u306b\u9069\u7528\u3059\u308b\u3053\u3068\u3067\u3001<code>params<\/code>\u306e\u51e6\u7406\u52b9\u7387\u3092\u5411\u4e0a\u3055\u305b\u3001Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5168\u4f53\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u5927\u5e45\u306b\u6539\u5584\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br>\u5e38\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30dc\u30c8\u30eb\u30cd\u30c3\u30af\u3092\u76e3\u8996\u3057\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u6700\u9069\u5316\u3092\u884c\u3046\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-45\">\u5b9f\u8df5\u7684\u306aparams\u306e\u4f7f\u7528\u4f8b\u3068\u5fdc\u7528\u30c6\u30af\u30cb\u30c3\u30af<\/h2>\n\n\n\n<p><code>params<\/code>\u306e\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u3092\u7406\u89e3\u3057\u305f\u3089\u3001\u6b21\u306f\u5b9f\u8df5\u7684\u306a\u4f7f\u7528\u4f8b\u3068\u5fdc\u7528\u30c6\u30af\u30cb\u30c3\u30af\u3092\u5b66\u3073\u307e\u3057\u3087\u3046\u3002<br>\u3053\u3053\u3067\u306f\u3001\u5b9f\u969b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u983b\u7e41\u306b\u906d\u9047\u3059\u308b\u72b6\u6cc1\u3067\u306e<code>params<\/code>\u306e\u6d3b\u7528\u65b9\u6cd5\u3092\u8a73\u3057\u304f\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-46\">\u691c\u7d22\u6a5f\u80fd\u306e\u5b9f\u88c5\u306b\u304a\u3051\u308bparams\u306e\u6d3b\u7528<\/h3>\n\n\n\n<p>\u691c\u7d22\u6a5f\u80fd\u306f\u591a\u304f\u306eWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u91cd\u8981\u306a\u8981\u7d20\u3067\u3059\u3002<code>params<\/code>\u3092\u52b9\u679c\u7684\u306b\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u67d4\u8edf\u3067\u5f37\u529b\u306a\u691c\u7d22\u6a5f\u80fd\u3092\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class ProductsController &lt; ApplicationController\n  def index\n    @products = Product.all\n    @products = @products.where(\"name LIKE ?\", \"%#{params[:name]}%\") if params[:name].present?\n    @products = @products.where(category: params[:category]) if params[:category].present?\n    @products = @products.where(\"price &gt;= ?\", params[:min_price]) if params[:min_price].present?\n    @products = @products.where(\"price &lt;= ?\", params[:max_price]) if params[:max_price].present?\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u4f8b\u3067\u306f\u3001\u8907\u6570\u306e\u691c\u7d22\u6761\u4ef6\u3092<code>params<\/code>\u304b\u3089\u53d6\u5f97\u3057\u3001\u30af\u30a8\u30ea\u3092\u52d5\u7684\u306b\u69cb\u7bc9\u3057\u3066\u3044\u307e\u3059\u3002<br>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u8003\u616e\u3059\u308b\u5834\u5408\u306f\u3001\u6b21\u306e\u3088\u3046\u306b\u30b9\u30b3\u30fc\u30d7\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class Product &lt; ApplicationRecord\n  scope :search_by_name, -&gt;(name) { where(\"name LIKE ?\", \"%#{name}%\") }\n  scope :filter_by_category, -&gt;(category) { where(category: category) }\n  scope :price_range, -&gt;(min, max) { where(price: min..max) }\nend\n\nclass ProductsController &lt; ApplicationController\n  def index\n    @products = Product.all\n    @products = @products.search_by_name(params[:name]) if params[:name].present?\n    @products = @products.filter_by_category(params[:category]) if params[:category].present?\n    @products = @products.price_range(params[:min_price], params[:max_price]) if params[:min_price].present? &amp;&amp; params[:max_price].present?\n  end\nend<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-47\">\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u3068params\u306e\u9023\u643a<\/h3>\n\n\n\n<p>\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u306f\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u6271\u3046\u969b\u306b\u4e0d\u53ef\u6b20\u3067\u3059\u3002<br><code>kaminari<\/code>\u3084<code>will_paginate<\/code>\u306a\u3069\u306egem\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u3067\u3082\u3001<code>params<\/code>\u3068\u9023\u643a\u3055\u305b\u308b\u3053\u3068\u3067\u67d4\u8edf\u306a\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u304c\u5b9f\u73fe\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class ArticlesController &lt; ApplicationController\n  def index\n    @articles = Article.order(created_at: :desc).page(params[:page]).per(params[:per_page] || 20)\n  end\nend<\/pre>\n\n\n\n<p>\u30d3\u30e5\u30fc\u3067\u306f\u6b21\u306e\u3088\u3046\u306b\u30ea\u30f3\u30af\u3092\u751f\u6210\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;%= paginate @articles, params: { per_page: params[:per_page] } %&gt;<\/pre>\n\n\n\n<p>\u3053\u308c\u306b\u3088\u308a\u3001\u30da\u30fc\u30b8\u756a\u53f7\u30681\u30da\u30fc\u30b8\u3042\u305f\u308a\u306e\u8868\u793a\u4ef6\u6570\u3092<code>params<\/code>\u3067\u5236\u5fa1\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-48\">API\u30d0\u30fc\u30b8\u30e7\u30cb\u30f3\u30b0\u306b\u304a\u3051\u308bparams\u306e\u5f79\u5272<\/h3>\n\n\n\n<p>API\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u306b\u304a\u3044\u3066\u3001<code>params<\/code>\u3092\u4f7f\u7528\u3057\u3066\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u8981\u6c42\u3059\u308b\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class ApiController &lt; ApplicationController\n  before_action :set_version\n\n  private\n\n  def set_version\n    @version = params[:version] || 'v1'\n    render json: { error: 'Unsupported API version' }, status: :bad_request unless ['v1', 'v2'].include?(@version)\n  end\nend\n\nclass UsersController &lt; ApiController\n  def index\n    case @version\n    when 'v1'\n      @users = User.all\n    when 'v2'\n      @users = User.includes(:posts)\n    end\n    render json: @users\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u65b9\u6cd5\u3067\u306f\u3001<code>\/users?version=v2<\/code>\u306e\u3088\u3046\u306bURL\u30d1\u30e9\u30e1\u30fc\u30bf\u3067API\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-49\">\u52d5\u7684\u306a\u30d5\u30a9\u30fc\u30e0\u751f\u6210\u3068params\u306e\u51e6\u7406<\/h3>\n\n\n\n<p>\u52d5\u7684\u306b\u30d5\u30a9\u30fc\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u8ffd\u52a0\u3059\u308b\u5834\u5408\u3001<code>params<\/code>\u306e\u914d\u5217\u3084\u30cd\u30b9\u30c8\u3055\u308c\u305f\u69cb\u9020\u3092\u6d3b\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class SurveyController &lt; ApplicationController\n  def create\n    @survey = Survey.new(survey_params)\n    if @survey.save\n      params[:questions].each do |question|\n        @survey.questions.create(content: question[:content], question_type: question[:type])\n      end\n      redirect_to @survey, notice: 'Survey was successfully created.'\n    else\n      render :new\n    end\n  end\n\n  private\n\n  def survey_params\n    params.require(:survey).permit(:title, :description)\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u306f\u3001\u52d5\u7684\u306b\u8ffd\u52a0\u3055\u308c\u305f\u8cea\u554f\u3092<code>params[:questions]<\/code>\u914d\u5217\u304b\u3089\u53d6\u5f97\u3057\u3001\u4fdd\u5b58\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-50\">\u8907\u6570\u30e2\u30c7\u30eb\u306e\u540c\u6642\u66f4\u65b0\u306b\u304a\u3051\u308bparams\u306e\u6d3b\u7528<\/h3>\n\n\n\n<p><code>accepts_nested_attributes_for<\/code>\u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001\u8907\u6570\u306e\u30e2\u30c7\u30eb\u3092\u4e00\u5ea6\u306b\u66f4\u65b0\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class Order &lt; ApplicationRecord\n  has_many :line_items\n  accepts_nested_attributes_for :line_items, allow_destroy: true\nend\n\nclass OrdersController &lt; ApplicationController\n  def update\n    @order = Order.find(params[:id])\n    if @order.update(order_params)\n      redirect_to @order, notice: 'Order was successfully updated.'\n    else\n      render :edit\n    end\n  end\n\n  private\n\n  def order_params\n    params.require(:order).permit(:customer_name, :address, line_items_attributes: [:id, :product_id, :quantity, :_destroy])\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u4f8b\u3067\u306f\u3001\u6ce8\u6587\u3068\u95a2\u9023\u3059\u308b\u5546\u54c1\u9805\u76ee\u3092\u540c\u6642\u306b\u66f4\u65b0\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u5b9f\u8df5\u7684\u306a\u4f7f\u7528\u4f8b\u3068\u5fdc\u7528\u30c6\u30af\u30cb\u30c3\u30af\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001<code>params<\/code>\u306e\u80fd\u529b\u3092\u6700\u5927\u9650\u306b\u5f15\u304d\u51fa\u3057\u3001\u3088\u308a\u67d4\u8edf\u3067\u5f37\u529b\u306aRails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br>\u5e38\u306b\u65b0\u3057\u3044\u30c6\u30af\u30cb\u30c3\u30af\u3084\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u5b66\u3073\u3001\u9069\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u52b9\u7387\u7684\u3067\u4fdd\u5b88\u6027\u306e\u9ad8\u3044\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-51\">\u30d5\u30a1\u30a4\u30eb\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3068params\u306e\u95a2\u4fc2<\/h3>\n\n\n\n<p>\u30d5\u30a1\u30a4\u30eb\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u6a5f\u80fd\u3092\u5b9f\u88c5\u3059\u308b\u969b\u3082\u3001<code>params<\/code>\u306f\u91cd\u8981\u306a\u5f79\u5272\u3092\u679c\u305f\u3057\u307e\u3059\u3002<br>Active Storage\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u3001\u6b21\u306e\u3088\u3046\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u51e6\u7406\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class UsersController &lt; ApplicationController\n  def update\n    @user = User.find(params[:id])\n    if @user.update(user_params)\n      redirect_to @user, notice: 'User was successfully updated.'\n    else\n      render :edit\n    end\n  end\n\n  private\n\n  def user_params\n    params.require(:user).permit(:name, :email, :avatar)\n  end\nend<\/pre>\n\n\n\n<p>\u30d3\u30e5\u30fc\u3067\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30d5\u30a9\u30fc\u30e0\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;%= form_with(model: @user, local: true) do |form| %&gt;\n  &lt;%= form.file_field :avatar %&gt;\n  &lt;%= form.submit %&gt;\n&lt;% end %&gt;<\/pre>\n\n\n\n<p>\u3053\u306e\u4f8b\u3067\u306f\u3001<code>params<\/code>\u3092\u901a\u3058\u3066\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u5b89\u5168\u306b\u51e6\u7406\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-52\">\u591a\u8a00\u8a9e\u5bfe\u5fdc\u30b5\u30a4\u30c8\u3067\u306elocale\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u6271\u3044\u65b9<\/h3>\n\n\n\n<p>\u56fd\u969b\u5316\uff08i18n\uff09\u5bfe\u5fdc\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u3001<code>params[:locale]<\/code>\u3092\u4f7f\u7528\u3057\u3066\u8a00\u8a9e\u3092\u5207\u308a\u66ff\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class ApplicationController &lt; ActionController::Base\n  before_action :set_locale\n\n  private\n\n  def set_locale\n    I18n.locale = params[:locale] || I18n.default_locale\n  end\n\n  def default_url_options\n    { locale: I18n.locale }\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u308c\u306b\u3088\u308a\u3001<code>\/en\/users<\/code>\u3084<code>\/ja\/users<\/code>\u306e\u3088\u3046\u306aURL\u3067\u8a00\u8a9e\u3092\u5207\u308a\u66ff\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-53\">\u6761\u4ef6\u4ed8\u304d\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3068params\u306e\u9023\u643a<\/h3>\n\n\n\n<p>\u7279\u5b9a\u306e\u6761\u4ef6\u4e0b\u3067\u306e\u307f\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3092\u884c\u3044\u305f\u3044\u5834\u5408\u3001<code>params<\/code>\u306e\u5024\u3092\u4f7f\u7528\u3057\u3066\u6761\u4ef6\u4ed8\u304d\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class User &lt; ApplicationRecord\n  attr_accessor :changing_password\n\n  validates :password, presence: true, if: :changing_password\n\n  def update_with_password(params)\n    self.changing_password = true\n    if params[:password].present?\n      update(params)\n    else\n      self.changing_password = false\n      update_without_password(params)\n    end\n  end\n\n  def update_without_password(params)\n    params.delete(:password)\n    params.delete(:password_confirmation)\n    update(params)\n  end\nend\n\nclass UsersController &lt; ApplicationController\n  def update\n    @user = User.find(params[:id])\n    if @user.update_with_password(user_params)\n      redirect_to @user, notice: 'User was successfully updated.'\n    else\n      render :edit\n    end\n  end\n\n  private\n\n  def user_params\n    params.require(:user).permit(:name, :email, :password, :password_confirmation)\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u4f8b\u3067\u306f\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u304c\u63d0\u4f9b\u3055\u308c\u305f\u5834\u5408\u306e\u307f\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u5909\u66f4\u3068\u95a2\u9023\u3059\u308b\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-54\">\u30d1\u30e9\u30e1\u30fc\u30bf\u306b\u57fa\u3065\u3044\u305f\u52d5\u7684\u306a\u30af\u30a8\u30ea\u69cb\u7bc9<\/h3>\n\n\n\n<p>\u8907\u96d1\u306a\u691c\u7d22\u3084\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u6a5f\u80fd\u3092\u5b9f\u88c5\u3059\u308b\u969b\u3001<code>params<\/code>\u3092\u4f7f\u7528\u3057\u3066\u52d5\u7684\u306b\u30af\u30a8\u30ea\u3092\u69cb\u7bc9\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class ProductsController &lt; ApplicationController\n  def index\n    @products = Product.all\n    filtering_params(params).each do |key, value|\n      @products = @products.public_send(\"filter_by_#{key}\", value) if value.present?\n    end\n  end\n\n  private\n\n  def filtering_params(params)\n    params.slice(:status, :location, :starts_with)\n  end\nend\n\nclass Product &lt; ApplicationRecord\n  scope :filter_by_status, -&gt;(status) { where status: status }\n  scope :filter_by_location, -&gt;(location_id) { where location_id: location_id }\n  scope :filter_by_starts_with, -&gt;(name) { where(\"name like ?\", \"#{name}%\")}\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u65b9\u6cd5\u306b\u3088\u308a\u3001<code>\/products?status=active&amp;location=1&amp;starts_with=A<\/code>\u306e\u3088\u3046\u306aURL\u3067\u67d4\u8edf\u306a\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-55\">\u307e\u3068\u3081<\/h3>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u5b9f\u8df5\u7684\u306a\u4f7f\u7528\u4f8b\u3068\u5fdc\u7528\u30c6\u30af\u30cb\u30c3\u30af\u306f\u3001<code>params<\/code>\u306e\u5f37\u529b\u3055\u3068\u67d4\u8edf\u6027\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002<br>\u9069\u5207\u306b\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5229\u70b9\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u3088\u308a\u67d4\u8edf\u3067\u52d5\u7684\u306a\u30e6\u30fc\u30b6\u30fc\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306e\u5b9f\u73fe<\/li>\n\n\n\n<li>\u52b9\u7387\u7684\u306a\u30c7\u30fc\u30bf\u51e6\u7406\u3068\u66f4\u65b0<\/li>\n\n\n\n<li>API\u306e\u67d4\u8edf\u6027\u3068\u62e1\u5f35\u6027\u306e\u5411\u4e0a<\/li>\n\n\n\n<li>\u4fdd\u5b88\u6027\u306e\u9ad8\u3044\u30b3\u30fc\u30c9\u306e\u4f5c\u6210<\/li>\n<\/ol>\n\n\n\n<p><code>params<\/code>\u306e\u6d3b\u7528\u65b9\u6cd5\u3092\u6df1\u304f\u7406\u89e3\u3057\u3001\u3053\u308c\u3089\u306e\u30c6\u30af\u30cb\u30c3\u30af\u3092\u9069\u5207\u306b\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u9ad8\u5ea6\u3067\u52b9\u7387\u7684\u306aRails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u767a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br>\u5e38\u306b\u65b0\u3057\u3044\u624b\u6cd5\u3084\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u306b\u6ce8\u76ee\u3057\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u54c1\u8cea\u5411\u4e0a\u306b\u52aa\u3081\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-56\">params\u306e\u30c6\u30b9\u30c8\u6226\u7565\uff1a\u54c1\u8cea\u3068\u5b89\u5168\u6027\u306e\u78ba\u4fdd<\/h2>\n\n\n\n<p>Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u54c1\u8cea\u3068\u5b89\u5168\u6027\u3092\u78ba\u4fdd\u3059\u308b\u305f\u3081\u306b\u306f\u3001<code>params<\/code>\u306e\u9069\u5207\u306a\u30c6\u30b9\u30c8\u304c\u4e0d\u53ef\u6b20\u3067\u3059\u3002<br>\u3053\u3053\u3067\u306f\u3001<code>params<\/code>\u306b\u95a2\u3059\u308b\u52b9\u679c\u7684\u306a\u30c6\u30b9\u30c8\u6226\u7565\u3068\u5177\u4f53\u7684\u306a\u5b9f\u88c5\u65b9\u6cd5\u3092\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-57\">\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30b9\u30da\u30c3\u30af\u3067\u306eparams\u30c6\u30b9\u30c8\u624b\u6cd5<\/h3>\n\n\n\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30b9\u30da\u30c3\u30af\u306f\u3001<code>params<\/code>\u306e\u51e6\u7406\u3092\u76f4\u63a5\u30c6\u30b9\u30c8\u3059\u308b\u306e\u306b\u9069\u3057\u3066\u3044\u307e\u3059\u3002<br>RSpec\u3092\u4f7f\u7528\u3057\u305f\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">RSpec.describe UsersController, type: :controller do\n  describe \"POST #create\" do\n    context \"with valid params\" do\n      it \"creates a new User\" do\n        expect {\n          post :create, params: { user: { name: \"John Doe\", email: \"john@example.com\" } }\n        }.to change(User, :count).by(1)\n      end\n    end\n\n    context \"with invalid params\" do\n      it \"does not create a new User\" do\n        expect {\n          post :create, params: { user: { name: \"\", email: \"invalid_email\" } }\n        }.to_not change(User, :count)\n      end\n    end\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u4f8b\u3067\u306f\u3001\u6709\u52b9\u306a<code>params<\/code>\u3068\u7121\u52b9\u306a<code>params<\/code>\u306e\u4e21\u65b9\u3092\u30c6\u30b9\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-58\">\u5883\u754c\u5024\u30c6\u30b9\u30c8\u3068\u30d1\u30e9\u30e1\u30fc\u30bf\u51e6\u7406<\/h3>\n\n\n\n<p>\u5883\u754c\u5024\u30c6\u30b9\u30c8\u306f\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u9650\u754c\u5024\u3084\u7279\u6b8a\u306a\u30b1\u30fc\u30b9\u3092\u30c6\u30b9\u30c8\u3059\u308b\u306e\u306b\u91cd\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">RSpec.describe ProductsController, type: :controller do\n  describe \"GET #index\" do\n    it \"handles minimum price correctly\" do\n      get :index, params: { min_price: 0 }\n      expect(assigns(:products)).to include(products(:cheap))\n      expect(assigns(:products)).to_not include(products(:free))\n    end\n\n    it \"handles maximum price correctly\" do\n      get :index, params: { max_price: 1000 }\n      expect(assigns(:products)).to include(products(:expensive))\n      expect(assigns(:products)).to_not include(products(:luxury))\n    end\n\n    it \"handles negative prices\" do\n      get :index, params: { min_price: -10 }\n      expect(response).to have_http_status(:bad_request)\n    end\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u4f8b\u3067\u306f\u3001\u4fa1\u683c\u306e\u5883\u754c\u5024\u3084\u7121\u52b9\u306a\u5024\uff08\u8ca0\u306e\u4fa1\u683c\uff09\u3092\u30c6\u30b9\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-59\">\u30e2\u30c3\u30af\u3068\u30b9\u30bf\u30d6\u3092\u4f7f\u3063\u305fparams\u306e\u30c6\u30b9\u30c8<\/h3>\n\n\n\n<p>\u5916\u90e8\u30b5\u30fc\u30d3\u30b9\u3084\u8907\u96d1\u306a\u51e6\u7406\u3092\u542b\u3080\u5834\u5408\u3001\u30e2\u30c3\u30af\u3084\u30b9\u30bf\u30d6\u3092\u4f7f\u7528\u3057\u3066\u30c6\u30b9\u30c8\u3092\u7c21\u7565\u5316\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">RSpec.describe OrdersController, type: :controller do\n  describe \"POST #create\" do\n    it \"processes payment with correct amount\" do\n      payment_service = instance_double(\"PaymentService\")\n      allow(PaymentService).to receive(:new).and_return(payment_service)\n      expect(payment_service).to receive(:process).with(100.00)\n\n      post :create, params: { order: { amount: \"100.00\" } }\n    end\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u4f8b\u3067\u306f\u3001\u652f\u6255\u3044\u51e6\u7406\u3092\u30e2\u30c3\u30af\u5316\u3057\u3001\u6b63\u3057\u3044\u91d1\u984d\u304c\u6e21\u3055\u308c\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-60\">Strong Parameters\u306e\u30c6\u30b9\u30c8<\/h3>\n\n\n\n<p>Strong Parameters\u306e\u8a2d\u5b9a\u304c\u6b63\u3057\u304f\u6a5f\u80fd\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u30c6\u30b9\u30c8\u3082\u91cd\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">RSpec.describe UsersController, type: :controller do\n  describe \"PUT #update\" do\n    let(:user) { create(:user) }\n\n    it \"allows whitelisted parameters\" do\n      put :update, params: { id: user.id, user: { name: \"New Name\", email: \"new@example.com\" } }\n      user.reload\n      expect(user.name).to eq \"New Name\"\n      expect(user.email).to eq \"new@example.com\"\n    end\n\n    it \"does not allow non-whitelisted parameters\" do\n      put :update, params: { id: user.id, user: { admin: true } }\n      user.reload\n      expect(user.admin).to be_falsey\n    end\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u30c6\u30b9\u30c8\u3067\u306f\u3001\u8a31\u53ef\u3055\u308c\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u3068\u8a31\u53ef\u3055\u308c\u3066\u3044\u306a\u3044\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u4e21\u65b9\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-61\">\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u95a2\u9023\u306eparams\u30c6\u30b9\u30c8<\/h3>\n\n\n\n<p>CSRF\u5bfe\u7b56\u3084XSS\u5bfe\u7b56\u306a\u3069\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u306b\u95a2\u3059\u308b\u30c6\u30b9\u30c8\u3082\u91cd\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">RSpec.describe ApplicationController, type: :controller do\n  controller do\n    def index\n      render plain: \"OK\"\n    end\n  end\n\n  it \"protects from CSRF\" do\n    expect(controller.request.forgery_protection_strategy).to_not be_nil\n  end\nend\n\nRSpec.describe CommentsController, type: :controller do\n  it \"sanitizes user input\" do\n    post :create, params: { comment: { content: \"&lt;script&gt;alert('XSS')&lt;\/script&gt;\" } }\n    comment = Comment.last\n    expect(comment.content).to_not include \"&lt;script&gt;\"\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u30c6\u30b9\u30c8\u3067\u306f\u3001CSRF\u4fdd\u8b77\u304c\u6709\u52b9\u3067\u3042\u308b\u3053\u3068\u3068\u3001\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u304c\u9069\u5207\u306b\u30b5\u30cb\u30bf\u30a4\u30ba\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-62\">\u7d71\u5408\u30c6\u30b9\u30c8\u3067\u306eparams\u306e\u6271\u3044<\/h3>\n\n\n\n<p>\u30b7\u30b9\u30c6\u30e0\u30c6\u30b9\u30c8\u3084\u7d71\u5408\u30c6\u30b9\u30c8\u3067\u306f\u3001\u5b9f\u969b\u306e\u30e6\u30fc\u30b6\u30fc\u64cd\u4f5c\u3092\u6a21\u5023\u3057\u3066params\u3092\u30c6\u30b9\u30c8\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">RSpec.describe \"User registration\", type: :system do\n  it \"allows a user to register\" do\n    visit new_user_registration_path\n    fill_in \"Name\", with: \"John Doe\"\n    fill_in \"Email\", with: \"john@example.com\"\n    fill_in \"Password\", with: \"password123\"\n    fill_in \"Password confirmation\", with: \"password123\"\n    click_button \"Sign up\"\n\n    expect(page).to have_content \"Welcome! You have signed up successfully.\"\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u30c6\u30b9\u30c8\u3067\u306f\u3001\u30d5\u30a9\u30fc\u30e0\u5165\u529b\u304b\u3089<code>params<\/code>\u306e\u751f\u6210\u3001\u51e6\u7406\u307e\u3067\u306e\u4e00\u9023\u306e\u6d41\u308c\u3092\u30c6\u30b9\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-63\">\u307e\u3068\u3081<\/h3>\n\n\n\n<p><code>params<\/code>\u306e\u30c6\u30b9\u30c8\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u54c1\u8cea\u3068\u5b89\u5168\u6027\u3092\u78ba\u4fdd\u3059\u308b\u305f\u3081\u306b\u4e0d\u53ef\u6b20\u3067\u3059\u3002<br>\u4ee5\u4e0b\u306e\u70b9\u306b\u6ce8\u610f\u3057\u3066\u30c6\u30b9\u30c8\u6226\u7565\u3092\u7acb\u3066\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<div class=\"wp-block-sgb-block-simple sgb-box-simple sgb-box-simple--title-normal sgb-box-simple--with-border\"><div style=\"background-color:var(--wp--preset--color--sango-main);color:#FFF\" class=\"sgb-box-simple__title\">\u30c6\u30b9\u30c8\u6226\u7565\u3092\u7acb\u3066\u308b\u969b\u306e5\u3064\u306e\u6ce8\u610f\u70b9<\/div><div class=\"sgb-box-simple__body\" style=\"border-color:var(--wp--preset--color--sango-main);background-color:#FFF\">\n<ol class=\"wp-block-list\">\n<li>\u69d8\u3005\u306a\u30b7\u30ca\u30ea\u30aa\u3068\u5165\u529b\u5024\u3092\u30ab\u30d0\u30fc\u3059\u308b<\/li>\n\n\n\n<li>\u5883\u754c\u5024\u3084\u7279\u6b8a\u306a\u30b1\u30fc\u30b9\u3092\u5fd8\u308c\u305a\u306b\u30c6\u30b9\u30c8\u3059\u308b<\/li>\n\n\n\n<li>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u95a2\u9023\u306e\u30c6\u30b9\u30c8\u3092\u6020\u3089\u306a\u3044<\/li>\n\n\n\n<li>\u7d71\u5408\u30c6\u30b9\u30c8\u3067\u5b9f\u969b\u306e\u30e6\u30fc\u30b6\u30fc\u64cd\u4f5c\u3092\u6a21\u5023\u3059\u308b<\/li>\n\n\n\n<li>\u30c6\u30b9\u30c8\u306e\u4fdd\u5b88\u6027\u3068\u53ef\u8aad\u6027\u3092\u4fdd\u3064<\/li>\n<\/ol>\n<\/div><\/div>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u30c6\u30b9\u30c8\u6226\u7565\u3092\u9069\u5207\u306b\u5b9f\u88c5\u3059\u308b\u3053\u3068\u3067\u3001<code>params<\/code>\u306b\u95a2\u9023\u3059\u308b\u591a\u304f\u306e\u6f5c\u5728\u7684\u306a\u554f\u984c\u3092\u4e8b\u524d\u306b\u767a\u898b\u3057\u3001\u4fee\u6b63\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br>\u3055\u3089\u306b\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u54c1\u8cea\u5411\u4e0a\u3068\u4fdd\u5b88\u6027\u306e\u6539\u5584\u306b\u3082\u3064\u306a\u304c\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-64\">\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u751f\u6210\u30c4\u30fc\u30eb\u3068params\u306e\u9023\u643a<\/h3>\n\n\n\n<p>\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u306e\u751f\u6210\u306b\u306f\u3001FactoryBot\u306a\u3069\u306e\u30c4\u30fc\u30eb\u3092\u4f7f\u7528\u3059\u308b\u3068\u52b9\u7387\u7684\u3067\u3059\u3002<br>\u3053\u308c\u3089\u306e\u30c4\u30fc\u30eb\u3092<code>params<\/code>\u306e\u30c6\u30b9\u30c8\u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u73fe\u5b9f\u7684\u3067\u591a\u69d8\u306a\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u3092\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">FactoryBot.define do\n  factory :user do\n    name { \"John Doe\" }\n    email { \"john@example.com\" }\n    password { \"password123\" }\n  end\nend\n\nRSpec.describe UsersController, type: :controller do\n  describe \"POST #create\" do\n    it \"creates a user with valid params\" do\n      user_attributes = attributes_for(:user)\n      expect {\n        post :create, params: { user: user_attributes }\n      }.to change(User, :count).by(1)\n    end\n\n    it \"does not create a user with invalid email\" do\n      user_attributes = attributes_for(:user, email: \"invalid_email\")\n      expect {\n        post :create, params: { user: user_attributes }\n      }.not_to change(User, :count)\n    end\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u4f8b\u3067\u306f\u3001FactoryBot\u3092\u4f7f\u7528\u3057\u3066\u6709\u52b9\u306a\u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u3092\u751f\u6210\u3057\u3001\u305d\u308c\u3092<code>params<\/code>\u3068\u3057\u3066\u30c6\u30b9\u30c8\u306b\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-65\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30c6\u30b9\u30c8\u3068params\u306e\u95a2\u4fc2<\/h3>\n\n\n\n<p><code>params<\/code>\u306e\u51e6\u7406\u304c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306b\u4e0e\u3048\u308b\u5f71\u97ff\u3082\u8003\u616e\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br>\u7279\u306b\u3001\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u542b\u3080<code>params<\/code>\u3084\u8907\u96d1\u306a\u51e6\u7406\u3092\u8981\u3059\u308b<code>params<\/code>\u306e\u5834\u5408\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30c6\u30b9\u30c8\u3092\u884c\u3046\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">require 'benchmark'\n\nRSpec.describe ProductsController, type: :controller do\n  describe \"GET #index with large params\" do\n    it \"processes large params within acceptable time\" do\n      large_params = { ids: (1..1000).to_a, categories: [\"A\", \"B\", \"C\"] * 100 }\n\n      time = Benchmark.measure do\n        get :index, params: large_params\n      end\n\n      expect(time.real).to be &lt; 0.5  # \u51e6\u7406\u6642\u9593\u304c0.5\u79d2\u672a\u6e80\u3067\u3042\u308b\u3053\u3068\u3092\u671f\u5f85\n      expect(response).to have_http_status(:success)\n    end\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u30c6\u30b9\u30c8\u3067\u306f\u3001\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u542b\u3080<code>params<\/code>\u3092\u4f7f\u7528\u3057\u3066<code>index<\/code>\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u547c\u3073\u51fa\u3057\u3001\u51e6\u7406\u6642\u9593\u304c\u8a31\u5bb9\u7bc4\u56f2\u5185\u3067\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-66\">\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u578b\u5909\u63db\u30c6\u30b9\u30c8<\/h3>\n\n\n\n<p>Rails\u306f\u81ea\u52d5\u7684\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u578b\u5909\u63db\u3092\u884c\u3044\u307e\u3059\u304c\u3001\u3053\u306e\u6319\u52d5\u304c\u671f\u5f85\u901a\u308a\u3067\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u30c6\u30b9\u30c8\u3082\u91cd\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">RSpec.describe OrdersController, type: :controller do\n  describe \"POST #create\" do\n    it \"correctly converts numeric strings to integers\" do\n      post :create, params: { order: { quantity: \"5\" } }\n      expect(controller.params[:order][:quantity]).to eq 5\n      expect(controller.params[:order][:quantity]).to be_a(Integer)\n    end\n\n    it \"handles non-numeric strings appropriately\" do\n      post :create, params: { order: { quantity: \"five\" } }\n      expect(controller.params[:order][:quantity]).to eq \"five\"\n      expect(controller.params[:order][:quantity]).to be_a(String)\n    end\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u30c6\u30b9\u30c8\u3067\u306f\u3001\u6570\u5024\u6587\u5b57\u5217\u304c\u9069\u5207\u306b\u6574\u6570\u306b\u5909\u63db\u3055\u308c\u308b\u3053\u3068\u3001\u304a\u3088\u3073\u975e\u6570\u5024\u6587\u5b57\u5217\u304c\u6587\u5b57\u5217\u306e\u307e\u307e\u4fdd\u6301\u3055\u308c\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-67\">\u56fd\u969b\u5316\uff08i18n\uff09\u306b\u95a2\u3059\u308bparams\u30c6\u30b9\u30c8<\/h3>\n\n\n\n<p>\u591a\u8a00\u8a9e\u5bfe\u5fdc\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u3001<code>params[:locale]<\/code>\u306e\u51e6\u7406\u304c\u6b63\u3057\u304f\u6a5f\u80fd\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u30c6\u30b9\u30c8\u3082\u91cd\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">RSpec.describe ApplicationController, type: :controller do\n  controller do\n    def index\n      render plain: \"Current locale: #{I18n.locale}\"\n    end\n  end\n\n  describe \"GET #index with locale\" do\n    it \"sets the correct locale based on params\" do\n      get :index, params: { locale: 'fr' }\n      expect(response.body).to include \"Current locale: fr\"\n    end\n\n    it \"uses default locale when no locale param is provided\" do\n      get :index\n      expect(response.body).to include \"Current locale: en\"  # \u30c7\u30d5\u30a9\u30eb\u30c8\u30ed\u30b1\u30fc\u30eb\u304c\u82f1\u8a9e\u306e\u5834\u5408\n    end\n  end\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u30c6\u30b9\u30c8\u3067\u306f\u3001<code>params[:locale]<\/code>\u306b\u57fa\u3065\u3044\u3066\u6b63\u3057\u3044\u30ed\u30b1\u30fc\u30eb\u304c\u8a2d\u5b9a\u3055\u308c\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-68\">\u30c6\u30b9\u30c8\u30ab\u30d0\u30ec\u30c3\u30b8\u306e\u78ba\u8a8d<\/h3>\n\n\n\n<p>\u6700\u5f8c\u306b\u3001<code>params<\/code>\u306b\u95a2\u9023\u3059\u308b\u30b3\u30fc\u30c9\u306e\u30c6\u30b9\u30c8\u30ab\u30d0\u30ec\u30c3\u30b8\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002<br>SimpleCov\u306a\u3069\u306e\u30c4\u30fc\u30eb\u3092\u4f7f\u7528\u3057\u3066\u3001\u30c6\u30b9\u30c8\u30ab\u30d0\u30ec\u30c3\u30b8\u3092\u6e2c\u5b9a\u3057\u3001\u4e0d\u8db3\u3057\u3066\u3044\u308b\u90e8\u5206\u3092\u7279\u5b9a\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">require 'simplecov'\nSimpleCov.start 'rails' do\n  add_filter '\/test\/'\n  add_filter '\/config\/'\n  add_filter '\/vendor\/'\n\n  add_group 'Controllers', 'app\/controllers'\n  add_group 'Models', 'app\/models'\n  add_group 'Helpers', 'app\/helpers'\n  add_group 'Libraries', 'lib'\nend<\/pre>\n\n\n\n<p>\u3053\u306e\u8a2d\u5b9a\u3092\u30c6\u30b9\u30c8\u30b9\u30a4\u30fc\u30c8\u306b\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3067\u3001\u30c6\u30b9\u30c8\u5b9f\u884c\u5f8c\u306b\u30ab\u30d0\u30ec\u30c3\u30b8\u30ec\u30dd\u30fc\u30c8\u304c\u751f\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-69\">\u307e\u3068\u3081<\/h3>\n\n\n\n<p><code>params<\/code>\u306e\u30c6\u30b9\u30c8\u306f\u591a\u5c90\u306b\u308f\u305f\u308a\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u54c1\u8cea\u3068\u5b89\u5168\u6027\u3092\u78ba\u4fdd\u3059\u308b\u4e0a\u3067\u975e\u5e38\u306b\u91cd\u8981\u3067\u3059\u3002<br>\u4ee5\u4e0b\u306e\u70b9\u306b\u6ce8\u610f\u3057\u3066\u3001\u5305\u62ec\u7684\u306a\u30c6\u30b9\u30c8\u6226\u7565\u3092\u7acb\u3066\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u57fa\u672c\u7684\u306aCRUD\u64cd\u4f5c\u306b\u304a\u3051\u308bparams\u306e\u51e6\u7406\u3092\u30c6\u30b9\u30c8\u3059\u308b<\/li>\n\n\n\n<li>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u95a2\u9023\u306e\u30c6\u30b9\u30c8\u3092\u5fb9\u5e95\u3059\u308b\uff08CSRF\u3001XSS\u5bfe\u7b56\u306a\u3069\uff09<\/li>\n\n\n\n<li>\u5883\u754c\u5024\u3084\u7279\u6b8a\u306a\u30b1\u30fc\u30b9\u3092\u8003\u616e\u3057\u305f\u30c6\u30b9\u30c8\u3092\u884c\u3046<\/li>\n\n\n\n<li>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3078\u306e\u5f71\u97ff\u3092\u8003\u616e\u3057\u305f\u30c6\u30b9\u30c8\u3092\u5b9f\u65bd\u3059\u308b<\/li>\n\n\n\n<li>\u56fd\u969b\u5316\u5bfe\u5fdc\u3084\u578b\u5909\u63db\u306a\u3069\u3001Rails\u7279\u6709\u306e\u6a5f\u80fd\u306b\u95a2\u3059\u308b\u30c6\u30b9\u30c8\u3092\u884c\u3046<\/li>\n\n\n\n<li>\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u751f\u6210\u30c4\u30fc\u30eb\u3092\u6d3b\u7528\u3057\u3066\u3001\u52b9\u7387\u7684\u304b\u3064\u7db2\u7f85\u7684\u306a\u30c6\u30b9\u30c8\u3092\u5b9f\u73fe\u3059\u308b<\/li>\n\n\n\n<li>\u30c6\u30b9\u30c8\u30ab\u30d0\u30ec\u30c3\u30b8\u3092\u5b9a\u671f\u7684\u306b\u78ba\u8a8d\u3057\u3001\u4e0d\u8db3\u3057\u3066\u3044\u308b\u90e8\u5206\u3092\u88dc\u5b8c\u3059\u308b<\/li>\n<\/ol>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u6226\u7565\u3092\u9069\u5207\u306b\u5b9f\u88c5\u3059\u308b\u3053\u3068\u3067\u3001<code>params<\/code>\u306b\u95a2\u9023\u3059\u308b\u6f5c\u5728\u7684\u306a\u554f\u984c\u3092\u4e8b\u524d\u306b\u767a\u898b\u3057\u3001\u3088\u308a\u5805\u7262\u3067\u4fe1\u983c\u6027\u306e\u9ad8\u3044Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u767a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-70\">\u307e\u3068\u3081\uff1aRuby on Rails params\u30de\u30b9\u30bf\u30fc\u3078\u306e\u9053<\/h2>\n\n\n\n<p>\u672c\u8a18\u4e8b\u3067\u306f\u3001Ruby on Rails\u306b\u304a\u3051\u308b<code>params<\/code>\u306e\u91cd\u8981\u6027\u3068\u3001\u305d\u306e\u52b9\u679c\u7684\u306a\u6d3b\u7528\u65b9\u6cd5\u306b\u3064\u3044\u3066\u8a73\u3057\u304f\u89e3\u8aac\u3057\u3066\u304d\u307e\u3057\u305f\u3002<br><code>params<\/code>\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u304b\u3089\u306e\u5165\u529b\u3092\u51e6\u7406\u3057\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u52d5\u7684\u306a\u632f\u308b\u821e\u3044\u3092\u5b9f\u73fe\u3059\u308b\u4e0a\u3067\u6b20\u304b\u305b\u306a\u3044\u8981\u7d20\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u79c1\u305f\u3061\u306f\u3001<code>params<\/code>\u306e\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u304b\u3089\u59cb\u307e\u308a\u3001Strong Parameters\u306b\u3088\u308b\u5b89\u5168\u306a\u30c7\u30fc\u30bf\u51e6\u7406\u3001\u8907\u96d1\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u306e\u6271\u3044\u65b9\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u3001\u305d\u3057\u3066\u5b9f\u8df5\u7684\u306a\u4f7f\u7528\u4f8b\u3068\u5fdc\u7528\u30c6\u30af\u30cb\u30c3\u30af\u307e\u3067\u3001\u5e45\u5e83\u3044\u30c8\u30d4\u30c3\u30af\u3092\u30ab\u30d0\u30fc\u3057\u307e\u3057\u305f\u3002<br>\u3055\u3089\u306b\u3001<code>params<\/code>\u306b\u95a2\u3059\u308b\u30c6\u30b9\u30c8\u6226\u7565\u306b\u3064\u3044\u3066\u3082\u5b66\u3073\u3001\u54c1\u8cea\u3068\u5b89\u5168\u6027\u306e\u78ba\u4fdd\u306e\u91cd\u8981\u6027\u3092\u7406\u89e3\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u77e5\u8b58\u3092\u8eab\u306b\u3064\u3051\u3001\u5b9f\u8df5\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u5805\u7262\u3067\u52b9\u7387\u7684\u306aRails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u767a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br>\u3057\u304b\u3057\u3001\u3053\u3053\u3067\u5b66\u3093\u3060\u3053\u3068\u306f\u3042\u304f\u307e\u3067\u3082\u59cb\u307e\u308a\u3067\u3059\u3002<br>\u6280\u8853\u306f\u65e5\u3005\u9032\u5316\u3057\u3001\u65b0\u3057\u3044\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3084\u624b\u6cd5\u304c\u751f\u307e\u308c\u7d9a\u3051\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4eca\u5f8c\u306f\u3001\u3053\u3053\u3067\u5f97\u305f\u77e5\u8b58\u3092\u57fa\u790e\u3068\u3057\u3066\u3001\u5b9f\u969b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u306e\u9069\u7528\u3092\u901a\u3058\u3066\u7d4c\u9a13\u3092\u7a4d\u307f\u3001\u3055\u3089\u306a\u308b\u7406\u89e3\u3092\u6df1\u3081\u3066\u3044\u3063\u3066\u304f\u3060\u3055\u3044\u3002<br>\u307e\u305f\u3001Rails\u30b3\u30df\u30e5\u30cb\u30c6\u30a3\u306e\u6700\u65b0\u306e\u52d5\u5411\u306b\u3082\u6ce8\u76ee\u3057\u3001\u5e38\u306b\u5b66\u3073\u7d9a\u3051\u308b\u59ff\u52e2\u3092\u6301\u3064\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<p><code>params<\/code>\u306e\u30de\u30b9\u30bf\u30fc\u3078\u306e\u9053\u306f\u7d42\u308f\u308a\u306e\u306a\u3044\u65c5\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u3057\u304b\u3057\u3001\u305d\u306e\u904e\u7a0b\u3067\u5f97\u3089\u308c\u308b\u77e5\u8b58\u3068\u7d4c\u9a13\u306f\u3001\u3042\u306a\u305f\u3092\u3088\u308a\u512a\u308c\u305fRails\u958b\u767a\u8005\u3078\u3068\u6210\u9577\u3055\u305b\u308b\u3067\u3057\u3087\u3046\u3002<br>\u3055\u3042\u3001\u3053\u3053\u304b\u3089\u304c\u672c\u5f53\u306e\u59cb\u307e\u308a\u3067\u3059\u3002<br>\u3042\u306a\u305f\u306e<code>params<\/code>\u30de\u30b9\u30bf\u30fc\u3078\u306e\u5192\u967a\u3092\u3001\u5fc3\u304b\u3089\u306e\u58f0\u63f4\u3068\u3068\u3082\u306b\u898b\u5b88\u3063\u3066\u3044\u307e\u3059\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u304a\u3044\u3066\u3001\u30e6\u30fc\u30b6\u30fc\u304b\u3089\u306e\u30c7\u30fc\u30bf\u3092\u9069\u5207\u306b\u6271\u3046\u3053\u3068\u306f\u975e\u5e38\u306b\u91cd\u8981\u3067\u3059\u3002Ruby on Rails\u3067\u306f\u3001params\u3068\u3044\u3046\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u901a\u3058\u3066\u3053\u308c\u3092\u5b9f\u73fe\u3057\u3066\u3044\u307e\u3059\u3002\u3057\u304b\u3057\u3001params\u306e\u4f7f\u3044\u65b9\u3092\u5b8c\u5168\u306b\u7406 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":3119,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,44],"tags":[],"class_list":{"0":"post-114","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-ruby","8":"category-ruby-rails"},"_links":{"self":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=114"}],"version-history":[{"count":1,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/114\/revisions"}],"predecessor-version":[{"id":115,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/114\/revisions\/115"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/media\/3119"}],"wp:attachment":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}