{"id":65270,"date":"2021-08-01T08:08:09","date_gmt":"1970-01-01T00:00:00","guid":{"rendered":"https:\/\/www.sejuku.net\/blog\/?p=65270"},"modified":"2024-05-06T11:50:05","modified_gmt":"2024-05-06T02:50:05","slug":"%e3%80%90rails%e5%85%a5%e9%96%80%e3%80%91update_all%e3%81%a7%e3%83%ac%e3%82%b3%e3%83%bc%e3%83%89%e3%82%92%e3%82%b5%e3%82%af%e3%83%83%e3%81%a8%e6%9b%b4%e6%96%b0%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.sejuku.net\/blog\/65270","title":{"rendered":"\u3010Rails\u5165\u9580\u3011update_all\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308b"},"content":{"rendered":"<p><span style=\"color: #339966;\"><strong>Ruby on Rails<\/strong><\/span>\uff08\u4ee5\u964d\u3001<span style=\"color: #339966;\"><strong>Rails<\/strong><\/span>\uff09\u3067\u3001\u30ec\u30b3\u30fc\u30c9\u3092\u66f4\u65b0\u3059\u308b\u65b9\u6cd5\u306f\u3044\u304f\u3064\u3082\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u3054\u5b58\u77e5\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001\u305d\u306e\u4e2d\u304b\u3089\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3084\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u5b9f\u884c\u305b\u305a\u306b\u3001<span style=\"color: #254df2;\"><strong>\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308b<\/strong><\/span><span style=\"color: #54a870;\"><strong>update_all<\/strong><\/span>\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>update_all\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u76ee\u7684\u3067\u4f7f\u3048\u308b\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002<\/p>\n<div style=\"padding: 10px 5px 10px 20px; margin-bottom: 20px; border: 2px solid #585858;\">\u30fb\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u3092\u6f0f\u308c\u306a\u304f\u66f4\u65b0\u3059\u308b<br \/>\n\u30fb\u6761\u4ef6\u306b\u4e00\u81f4\u3057\u305f\u30ec\u30b3\u30fc\u30c9\u3092\u3059\u3079\u3066\u66f4\u65b0\u3059\u308b<br \/>\n\u30fb\u4e0a\u4f4d3\u4ef6\u306e\u30ec\u30b3\u30fc\u30c9\u306e\u307f\u3092\u66f4\u65b0\u3059\u308b<br \/>\n\u30fb\u30e9\u30f3\u30c0\u30e0\u306b\u62bd\u51fa\u3057\u305f2\u4ef6\u306e\u30ec\u30b3\u30fc\u30c9\u306e\u307f\u3092\u66f4\u65b0\u3059\u308b<\/div>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001scaffold\u3092\u4f7f\u3063\u3066Web\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3057\u3001update_all\u306e\u4f7f\u3044\u304b\u305f\u3092<span style=\"color: #f75959;\"><strong>\u5177\u4f53\u7684<\/strong><\/span>\u306b\u898b\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\u3001\u306f\u3058\u3081\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>update_all\u3068\u306f<\/h2>\n<p><span style=\"color: #54a870;\"><strong>update_all<\/strong><\/span>\u306f\u3001\u8907\u6570\u306e\u30ec\u30b3\u30fc\u30c9\u3092\u4e00\u62ec\u66f4\u65b0\u3059\u308b\u305f\u3081\u306e\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002<\/p>\n<p>update_all\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true \" >\u30e2\u30c7\u30eb.update_all(updates)<\/pre>\n<p>\u5f15\u6570\u306b\u6307\u5b9a\u3059\u308b<span style=\"color: #54a870;\"><strong>updates<\/strong><\/span>\u306b\u306f\u3001<span style=\"color: #254df2;\"><strong>SQL\u6587\u306eSET\u90e8\u5206\u3092\u8868\u3059\u6587\u5b57\u5217\u3084\u30cf\u30c3\u30b7\u30e5<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n<table id=\"tablepress-596\" class=\"tablepress tablepress-id-596\">\n<thead>\n<tr class=\"row-1\">\n\t<th class=\"column-1\">\u6307\u5b9a\u65b9\u6cd5<\/th><th class=\"column-2\">\u4f8b<\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">\u6587\u5b57\u5217<\/td><td class=\"column-2\">User.update_all(&quot;'check' = 'false'&quot;)<br \/>\nUser.update_all(&quot;'check' = 'false', 'birth' = '2000-01-01'&quot;)<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">\u30cf\u30c3\u30b7\u30e5<\/td><td class=\"column-2\">User.update_all(check: false)<br \/>\nUser.update_all(check: false, birth: '2000-01-01')<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n<p>User.update_all(&#8220;&#8216;check&#8217; = &#8216;false'&#8221;)\u3084User.update_all(check: false)\u306f\u3001<span style=\"color: #254df2;\"><strong>User\u30c6\u30fc\u30d6\u30eb\u306e\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u306echeck\u3092false\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/strong><\/span><\/p>\n<p>\u3069\u3061\u3089\u306e\u66f8\u304d\u304b\u305f\u3067\u3082\u540c\u3058\u52d5\u4f5c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u901a\u5e38\u3001Active Record\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u5229\u7528\u3057\u3066\u5024\u3092\u66f4\u65b0\u3059\u308b\u3068\u3001<span style=\"color: #254df2;\"><strong>\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3084\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/strong><\/span><\/p>\n<p>\u3057\u304b\u3057\u3001update_all\u306f\u3001<span style=\"color: #f75959;\"><strong>ActiveRecord\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u7d4c\u7531\u3057\u306a\u3044<\/strong><\/span>\u66f4\u65b0\u65b9\u6cd5\u306e\u305f\u3081\u3001<span style=\"color: #ff0000; background-color: #ffff99;\"><strong>\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3084\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u304c\u5b9f\u884c\u3055\u308c\u307e\u305b\u3093<\/strong><\/span>\u306e\u3067\u3001\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<h2>\u52d5\u4f5c\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306eWeb\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3059\u308b<\/h2>\n<p>update_all\u306e\u96f0\u56f2\u6c17\u3092\u3064\u304b\u3093\u3060\u3068\u3053\u308d\u3067\u3001update_all\u306e\u52d5\u4f5c\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u3001Rails 5.1\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066Web\u30a2\u30d7\u30ea\u3092\u4f5c\u308a\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\uff081\uff09<span style=\"color: #339966;\"><strong>Rails<\/strong><\/span>\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<p>\u79c1\u306f\u3001\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3092\u53c2\u8003\u306b\u3001VirtualBox\u3067\u4f5c\u6210\u3057\u305f\u4eee\u60f3\u30d1\u30bd\u30b3\u30f3\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305fLinux Mint\u306b\u3001Rails\u306e\u958b\u767a\u74b0\u5883\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u57fa\u672c\u7684\u306b\u306f\u8a18\u4e8b\u306e\u624b\u9806\u306b\u5f93\u3063\u3066\u64cd\u4f5c\u3057\u307e\u3059\u304c\u3001app\/samurai\/sample1\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3059\u308b\u4ee3\u308f\u308a\u306b\u3001<span style=\"color: #54a870;\"><strong>app\/samurai\/update_all-demo\u30c7\u30a3\u30ec\u30af\u30c8\u30ea<\/strong><\/span>\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>Rails\u3092\u8d77\u52d5\u3057\u3066\u3001\u30d6\u30e9\u30a6\u30b6\u3067\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u305f\u3089\u3001\u3044\u3063\u305f\u3093Rails\u3092\u7d42\u4e86\u3057\u3066\u304b\u3089\u6b21\u306b\u9032\u307f\u307e\u3059\u3002<\/p>\n            <a href=\"https:\/\/www.sejuku.net\/blog\/39936\" class=\"blog-card-anchor\">\n                <div class=\"blog-card\">\n                <div class=\"blog-card-content\">\n                    <div class=\"blog-card-thumbnail\">\n                    <img decoding=\"async\" class=\"blog-card-thumbnail-img\" src=\"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2017\/12\/ruby_on_rails-150x86.jpg\">\n                    <\/div>\n                    <div class=\"blog-card-title-wrap\">\n                    <div class=\"blog-card-title\">\u521d\u5fc3\u8005\u3067\u3082\u304b\u3093\u305f\u3093\uff01Ruby on Rails \u306e\u958b\u767a\u74b0\u5883\u306e\u69cb\u7bc9\u624b\u9806\uff08Mac\/Windows \u4e21\u5bfe\u5fdc\uff09<\/div>\n                    <div class=\"blog-card-update-date\">\u66f4\u65b0\u65e5\uff1a2024\u5e745\u67086\u65e5<\/div>\n                    <\/div>\n                <\/div>\n                <\/div>\n            <\/a>\n            \n<p>Linux Mint\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306b\u3064\u3044\u3066\u306f\u3001\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3067\u8a73\u3057\u304f\u8aac\u660e\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n            <a href=\"https:\/\/www.sejuku.net\/blog\/56765\" class=\"blog-card-anchor\">\n                <div class=\"blog-card\">\n                <div class=\"blog-card-content\">\n                    <div class=\"blog-card-thumbnail\">\n                    <img decoding=\"async\" class=\"blog-card-thumbnail-img\" src=\"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/06\/linux-mint-150x86.jpg\">\n                    <\/div>\n                    <div class=\"blog-card-title-wrap\">\n                    <div class=\"blog-card-title\">Linux Mint Cinnamon\u30a8\u30c7\u30a3\u30b7\u30e7\u30f3\u3092\u4f7f\u3063\u3066\u307f\u3088\u3046<\/div>\n                    <div class=\"blog-card-update-date\">\u66f4\u65b0\u65e5\uff1a2024\u5e745\u67086\u65e5<\/div>\n                    <\/div>\n                <\/div>\n                <\/div>\n            <\/a>\n            \n<p>\uff082\uff09<span style=\"color: #339966;\"><strong>Gemfile<\/strong><\/span>\u306e\u6700\u7d42\u884c\u306b\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8ffd\u8a18\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"decode:true \" >gem 'hirb'\r\ngem 'hirb-unicode'<\/pre>\n<p>Hirb\u306b\u3064\u3044\u3066\u306f\u3001\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3067\u8a73\u3057\u304f\u8aac\u660e\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u3042\u308f\u305b\u3066\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n            <a href=\"https:\/\/www.sejuku.net\/blog\/27497\" class=\"blog-card-anchor\">\n                <div class=\"blog-card\">\n                <div class=\"blog-card-content\">\n                    <div class=\"blog-card-thumbnail\">\n                    <img decoding=\"async\" class=\"blog-card-thumbnail-img\" src=\"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2017\/07\/image-18-150x86.jpg\">\n                    <\/div>\n                    <div class=\"blog-card-title-wrap\">\n                    <div class=\"blog-card-title\">\u3010Rails\u5165\u9580\u3011\u521d\u5fc3\u8005\u304c\u77e5\u3063\u3066\u304a\u304f\u3079\u304d3\u3064\u306egem<\/div>\n                    <div class=\"blog-card-update-date\">\u66f4\u65b0\u65e5\uff1a2024\u5e745\u67086\u65e5<\/div>\n                    <\/div>\n                <\/div>\n                <\/div>\n            <\/a>\n            \n<p>\uff083\uff09\u65b0\u3057\u3044<span style=\"color: #339966;\"><strong>\u300c\u7aef\u672b\u300d<\/strong><\/span>\u3092\u8d77\u52d5\u3057\u3066\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u30921\u884c\u305a\u3064\u9806\u756a\u306b\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"decode:true \" >cd app\/samurai\/attributes-demo\r\nbundle install\r\nbin\/rails generate scaffold User name:string birth:date check:boolean\r\nbin\/rails db:migrate\r\nbin\/rails console<\/pre>\n<p>\uff084\uff09\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u30921\u884c\u305a\u3064\u9806\u756a\u306b\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"decode:true \" >User.create(name:\"\u5c71\u7530\u592a\u90ce\", birth:\"1991-09-22\")\r\nUser.create(name:\"\u9577\u702c\u6765\", birth:\"1991-10-18\")\r\nUser.create(name:\"\u7acb\u5ddd\u88d5\u7f8e\", birth:\"1968-06-28\")\r\nUser.create(name:\"\u524d\u7530\u9054\u90ce\", birth:\"1984-10-12\")\r\nUser.create(name:\"\u7d30\u5ddd\u4fee\u4e8c\", birth:\"1971-03-24\")\r\nUser.create(name:\"\u6728\u6751\u62d3\u78e8\", birth:\"1995-05-19\")\r\nexit<\/pre>\n<p>User\u30c6\u30fc\u30d6\u30eb\u306b\u30c7\u30fc\u30bf\u304c\u5165\u529b\u3055\u308c\u3001Rails\u30b3\u30f3\u30bd\u30fc\u30eb\u304c\u7d42\u4e86\u3057\u307e\u3059\u3002<\/p>\n<h2>update_all\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u4e00\u62ec\u66f4\u65b0\u3059\u308b<\/h2>\n<h3>\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u3092\u6f0f\u308c\u306a\u304f\u66f4\u65b0\u3059\u308b<\/h3>\n<p>\u6700\u3082\u7c21\u5358\u306a\u4f8b\u3067\u3059\u3002<\/p>\n<p>\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u306echeck\u3092true\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p>\uff081\uff09<span style=\"color: #339966;\"><strong>\u300c\u7aef\u672b\u300d<\/strong><\/span>\u3067\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true \" >bin\/rails console<\/pre>\n<p>\uff082\uff09\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u30921\u884c\u305a\u3064\u9806\u756a\u306b\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true \" >Hirb.enable\r\nUser.update_all(check: true)\r\nUser.all<\/pre>\n<p>\u5b9f\u884c\u7d50\u679c\uff1a<\/p>\n<pre class=\"lang:ruby decode:true \" >  User Load (0.3ms)  SELECT \"users\".* FROM \"users\"\r\n+----+----------+------------+-------+-------------------------+-------------------------+\r\n| id | name     | birth      | check | created_at              | updated_at              |\r\n+----+----------+------------+-------+-------------------------+-------------------------+\r\n| 1  | \u5c71\u7530\u592a\u90ce | 1991-09-22 | true  | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 2  | \u9577\u702c\u6765   | 1991-10-18 | true  | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 3  | \u7acb\u5ddd\u88d5\u7f8e | 1968-06-28 | true  | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 4  | \u524d\u7530\u9054\u90ce | 1984-10-12 | true  | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 5  | \u7d30\u5ddd\u4fee\u4e8c | 1971-03-24 | true  | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 6  | \u6728\u6751\u62d3\u78e8 | 1995-05-19 | true  | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n+----+----------+------------+-------+-------------------------+-------------------------+\r\n6 rows in set<\/pre>\n<h3>\u6761\u4ef6\u306b\u4e00\u81f4\u3057\u305f\u30ec\u30b3\u30fc\u30c9\u3092\u3059\u3079\u3066\u66f4\u65b0\u3059\u308b<\/h3>\n<p>40\u6b73\u672a\u6e80\uff08birth\u304c40.year.ago\u4ee5\u964d\uff09\u306eUser\u306b\u9650\u308a\u3001check\u3092true\u306b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\uff081\uff09<span style=\"color: #339966;\"><strong>\u300c\u7aef\u672b\u300d<\/strong><\/span>\u3067\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true \" >bin\/rails console<\/pre>\n<p>\uff082\uff09\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u30921\u884c\u305a\u3064\u9806\u756a\u306b\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true \" >Hirb.enable\r\nUser.update_all(check: false)\r\nUser.where(['birth > ?', 40.year.ago]).update_all(check: true)\r\nUser.all<\/pre>\n<p>\u5b9f\u884c\u7d50\u679c\uff1a<\/p>\n<pre class=\"lang:ruby decode:true \" >  User Load (0.1ms)  SELECT \"users\".* FROM \"users\"\r\n+----+----------+------------+-------+-------------------------+-------------------------+\r\n| id | name     | birth      | check | created_at              | updated_at              |\r\n+----+----------+------------+-------+-------------------------+-------------------------+\r\n| 1  | \u5c71\u7530\u592a\u90ce | 1991-09-22 | true  | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 2  | \u9577\u702c\u6765   | 1991-10-18 | true  | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 3  | \u7acb\u5ddd\u88d5\u7f8e | 1968-06-28 | false | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 4  | \u524d\u7530\u9054\u90ce | 1984-10-12 | true  | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 5  | \u7d30\u5ddd\u4fee\u4e8c | 1971-03-24 | false | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 6  | \u6728\u6751\u62d3\u78e8 | 1995-05-19 | true  | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n+----+----------+------------+-------+-------------------------+-------------------------+\r\n6 rows in set<\/pre>\n<h3>\u4e0a\u4f4d3\u4ef6\u306e\u30ec\u30b3\u30fc\u30c9\u306e\u307f\u3092\u66f4\u65b0\u3059\u308b<\/h3>\n<p>\u4eca\u5ea6\u306f\u3001\u4e0a\u4f4d3\u4f4d\uff08\u5e74\u9577\u8005\u4e0a\u4f4d3\u540d\uff09\u306b\u9650\u308a\u3001check\u3092true\u306b\u3059\u308b\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n<p>\uff081\uff09<span style=\"color: #339966;\"><strong>\u300c\u7aef\u672b\u300d<\/strong><\/span>\u3067\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true \" >bin\/rails console<\/pre>\n<p>\uff082\uff09\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u30921\u884c\u305a\u3064\u9806\u756a\u306b\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true \" >Hirb.enable\r\nUser.update_all(check: false)\r\nUser.order(:birth).limit(3).update_all(check: true)\r\nUser.all<\/pre>\n<p>\u5b9f\u884c\u7d50\u679c\uff1a<\/p>\n<pre class=\"lang:ruby decode:true \" >  User Load (0.1ms)  SELECT \"users\".* FROM \"users\"\r\n+----+----------+------------+-------+-------------------------+-------------------------+\r\n| id | name     | birth      | check | created_at              | updated_at              |\r\n+----+----------+------------+-------+-------------------------+-------------------------+\r\n| 1  | \u5c71\u7530\u592a\u90ce | 1991-09-22 | false | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 2  | \u9577\u702c\u6765   | 1991-10-18 | false | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 3  | \u7acb\u5ddd\u88d5\u7f8e | 1968-06-28 | true  | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 4  | \u524d\u7530\u9054\u90ce | 1984-10-12 | true  | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 5  | \u7d30\u5ddd\u4fee\u4e8c | 1971-03-24 | true  | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 6  | \u6728\u6751\u62d3\u78e8 | 1995-05-19 | false | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n+----+----------+------------+-------+-------------------------+-------------------------+\r\n6 rows in set<\/pre>\n<p><span style=\"color: #54a870;\"><strong>order<\/strong><\/span>\u3068<span style=\"color: #54a870;\"><strong>limit<\/strong><\/span>\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u4f7f\u3046\u3068\u3001\u4e00\u898b\u96e3\u3057\u305d\u3046\u306a\u66f4\u65b0\u3082\u7c21\u5358\u306b\u5b9f\u73fe\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<h3>\u30e9\u30f3\u30c0\u30e0\u306b\u62bd\u51fa\u3057\u305f2\u4ef6\u306e\u30ec\u30b3\u30fc\u30c9\u306e\u307f\u3092\u66f4\u65b0\u3059\u308b<\/h3>\n<p>\u5c11\u3057\u76ee\u5148\u3092\u5909\u3048\u3066\u3001\u30e9\u30f3\u30c0\u30e0\u306b\u62bd\u51fa\u3057\u305f2\u4ef6\u306e\u30ec\u30b3\u30fc\u30c9\u306e\u307f\u3001check\u3092true\u306b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u62bd\u9078\u306b\u4f7f\u3046\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u306d\u3002<\/p>\n<p>\uff081\uff09<span style=\"color: #339966;\"><strong>\u300c\u7aef\u672b\u300d<\/strong><\/span>\u3067\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true \" >bin\/rails console<\/pre>\n<p>\uff082\uff09\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u30921\u884c\u305a\u3064\u9806\u756a\u306b\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true \" >Hirb.enable\r\nUser.update_all(check: false)\r\nUser.where('id >= ?', rand(User.first.id..User.last.id)).limit(2).update_all(check: true)\r\nUser.all<\/pre>\n<p>\u5b9f\u884c\u7d50\u679c\uff1a<\/p>\n<pre class=\"lang:ruby decode:true \" >  User Load (0.1ms)  SELECT \"users\".* FROM \"users\"\r\n+----+----------+------------+-------+-------------------------+-------------------------+\r\n| id | name     | birth      | check | created_at              | updated_at              |\r\n+----+----------+------------+-------+-------------------------+-------------------------+\r\n| 1  | \u5c71\u7530\u592a\u90ce | 1991-09-22 | false | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 2  | \u9577\u702c\u6765   | 1991-10-18 | false | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 3  | \u7acb\u5ddd\u88d5\u7f8e | 1968-06-28 | false | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 4  | \u524d\u7530\u9054\u90ce | 1984-10-12 | false | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 5  | \u7d30\u5ddd\u4fee\u4e8c | 1971-03-24 | true  | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n| 6  | \u6728\u6751\u62d3\u78e8 | 1995-05-19 | true  | 2018-07-24 02:16:01 UTC | 2018-07-24 02:16:01 UTC |\r\n+----+----------+------------+-------+-------------------------+-------------------------+\r\n6 rows in set<\/pre>\n<p>\u203b\u6bce\u56de\u3001\u5b9f\u884c\u7d50\u679c\u304c\u7570\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u305d\u306e\u4ed6\u306e\u66f4\u65b0\u30e1\u30bd\u30c3\u30c9<\/h2>\n<p>\u521d\u3081\u306b\u3082\u66f8\u304d\u307e\u3057\u305f\u304c\u3001update_all\u3067\u306f<span style=\"color: #f75959;\"><strong>\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3084\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u304c\u5b9f\u884c\u3055\u308c\u307e\u305b\u3093\u3002<\/strong><\/span><\/p>\n<p>\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3084\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u304c\u5fc5\u8981\u306a\u3089\u3001<span style=\"color: #54a870;\"><strong>update<\/strong><\/span>\u3084<span style=\"color: #54a870;\"><strong>update_attributes<\/strong><\/span>\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p>Rails\u3067\u5229\u7528\u3067\u304d\u308b\u3001\u5024\u3092\u66f4\u65b0\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u306b\u3064\u3044\u3066\u306f\u3001\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3067\u8a73\u3057\u304f\u8aac\u660e\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u3042\u308f\u305b\u3066\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n            <a href=\"https:\/\/www.sejuku.net\/blog\/62009\" class=\"blog-card-anchor\">\n                <div class=\"blog-card\">\n                <div class=\"blog-card-content\">\n                    <div class=\"blog-card-thumbnail\">\n                    <img decoding=\"async\" class=\"blog-card-thumbnail-img\" src=\"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/rails_update_attribute1-150x86.jpg\">\n                    <\/div>\n                    <div class=\"blog-card-title-wrap\">\n                    <div class=\"blog-card-title\">\u3010Rails\u5165\u9580\u3011update_attributes\u3067\u66f4\u65b0\u3059\u308b\u65b9\u6cd5\u3092\u308f\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac<\/div>\n                    <div class=\"blog-card-update-date\">\u66f4\u65b0\u65e5\uff1a2024\u5e745\u67086\u65e5<\/div>\n                    <\/div>\n                <\/div>\n                <\/div>\n            <\/a>\n            \n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u4eca\u56de\u306f\u3001Rails\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u66f4\u65b0\u3059\u308b\u65b9\u6cd5\u306e\u4e00\u3064\u3067\u3042\u308b<span style=\"color: #54a870;\"><strong>update_all<\/strong><\/span>\u306e\u4f7f\u3044\u304b\u305f\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/p>\n<p><span style=\"color: #54a870;\"><strong>where<\/strong><\/span>\u3084<span style=\"color: #54a870;\"><strong>order<\/strong><\/span>\u3068\u7d44\u307f\u5408\u308f\u305b\u3066update_all\u3092\u4f7f\u3046\u3068\u3001<span style=\"color: #254df2;\"><strong>\u6761\u4ef6\u306b\u4e00\u81f4\u3057\u305f\u30ec\u30b3\u30fc\u30c9\u3060\u3051\u4e00\u62ec\u3057\u3066\u5024\u3092\u5909\u66f4\u3067\u304d\u307e\u3057\u305f\u3002<\/strong><\/span><\/p>\n<p>\u305d\u308c\u304b\u3089\u3001update_attributes\u306a\u3069\u3068\u306f\u7570\u306a\u308a\u3001update_all\u306f\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3084\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u304c\u5b9f\u884c\u3055\u308c\u306a\u3044\u305f\u3081\u3001<span style=\"color: #f75959;\"><strong>\u304a\u304b\u3057\u306a\u5024\u306b\u5909\u66f4\u3057\u306a\u3044\u3088\u3046\u306b\u5341\u5206\u6ce8\u610f\u3057\u307e\u3057\u3087\u3046\u3002<\/strong><\/span><\/p>\n<p>update_all\u306b\u9650\u3089\u305a\u3001\u3053\u3046\u3044\u3063\u305f\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u306f\u3001\u4f3c\u305f\u3088\u3046\u306a\u6a5f\u80fd\u306e\u30e1\u30bd\u30c3\u30c9\u3068\u306e\u9055\u3044\u3092\u7406\u89e3\u3057\u3066\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u5927\u5207\u3067\u3059\u3002<\/p>\n<p>\u4e00\u3064\u4e00\u3064\u4e01\u5be7\u306b\u52d5\u4f5c\u3092\u78ba\u8a8d\u3057\u306a\u304c\u3089\u4f7f\u7528\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ruby on Rails\uff08\u4ee5\u964d\u3001Rails\uff09\u3067\u3001\u30ec\u30b3\u30fc\u30c9\u3092\u66f4\u65b0\u3059\u308b\u65b9\u6cd5\u306f\u3044\u304f\u3064\u3082\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u3054\u5b58\u77e5\u3067\u3057\u3087\u3046\u304b\u3002 \u4eca\u56de\u306f\u3001\u305d\u306e\u4e2d\u304b\u3089\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3084\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u5b9f\u884c\u305b\u305a\u306b\u3001\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308bupdate [&hellip;]<\/p>\n","protected":false},"author":16433,"featured_media":65524,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"swell_btn_cv_data":"","footnotes":""},"categories":[2352],"tags":[14,1725],"class_list":["post-65270","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ruby-study","tag-ruby-on-rails","tag-update_all"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u3010Rails\u5165\u9580\u3011update_all\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308b | \u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0<\/title>\n<meta name=\"description\" content=\"\u3053\u306e\u8a18\u4e8b\u3067\u306f\u300c \u3010Rails\u5165\u9580\u3011update_all\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308b \u300d\u306b\u3064\u3044\u3066\u3001\u8ab0\u3067\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3092\u8aad\u3081\u3070\u3001\u3042\u306a\u305f\u306e\u60a9\u307f\u304c\u89e3\u6c7a\u3059\u308b\u3060\u3051\u3058\u3083\u306a\u304f\u3001\u65b0\u305f\u306a\u6c17\u4ed8\u304d\u3082\u767a\u898b\u3067\u304d\u308b\u3053\u3068\u3067\u3057\u3087\u3046\u3002\u304a\u60a9\u307f\u306e\u65b9\u306f\u305c\u3072\u3054\u4e00\u8aad\u304f\u3060\u3055\u3044\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sejuku.net\/blog\/65270\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010Rails\u5165\u9580\u3011update_all\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308b | \u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0\" \/>\n<meta property=\"og:description\" content=\"\u3053\u306e\u8a18\u4e8b\u3067\u306f\u300c \u3010Rails\u5165\u9580\u3011update_all\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308b \u300d\u306b\u3064\u3044\u3066\u3001\u8ab0\u3067\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3092\u8aad\u3081\u3070\u3001\u3042\u306a\u305f\u306e\u60a9\u307f\u304c\u89e3\u6c7a\u3059\u308b\u3060\u3051\u3058\u3083\u306a\u304f\u3001\u65b0\u305f\u306a\u6c17\u4ed8\u304d\u3082\u767a\u898b\u3067\u304d\u308b\u3053\u3068\u3067\u3057\u3087\u3046\u3002\u304a\u60a9\u307f\u306e\u65b9\u306f\u305c\u3072\u3054\u4e00\u8aad\u304f\u3060\u3055\u3044\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sejuku.net\/blog\/65270\" \/>\n<meta property=\"og:site_name\" content=\"\u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/sejuku2013\" \/>\n<meta property=\"article:published_time\" content=\"1970-01-01T00:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-06T02:50:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/image27.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"700\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@samuraijuku\" \/>\n<meta name=\"twitter:site\" content=\"@samuraijuku\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/65270#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/65270\"},\"author\":{\"name\":\"\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8\",\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/#\\\/schema\\\/person\\\/d20c57b59dba15001519a8a671183095\"},\"headline\":\"\u3010Rails\u5165\u9580\u3011update_all\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308b\",\"datePublished\":\"1970-01-01T00:00:00+00:00\",\"dateModified\":\"2024-05-06T02:50:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/65270\"},\"wordCount\":138,\"publisher\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/65270#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/image27.jpg\",\"keywords\":[\"Ruby on Rails\",\"update_all\"],\"articleSection\":[\"Ruby\u5b66\u7fd2\"],\"inLanguage\":\"ja\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/65270\",\"url\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/65270\",\"name\":\"\u3010Rails\u5165\u9580\u3011update_all\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308b | \u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/65270#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/65270#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/image27.jpg\",\"datePublished\":\"1970-01-01T00:00:00+00:00\",\"dateModified\":\"2024-05-06T02:50:05+00:00\",\"description\":\"\u3053\u306e\u8a18\u4e8b\u3067\u306f\u300c \u3010Rails\u5165\u9580\u3011update_all\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308b \u300d\u306b\u3064\u3044\u3066\u3001\u8ab0\u3067\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3092\u8aad\u3081\u3070\u3001\u3042\u306a\u305f\u306e\u60a9\u307f\u304c\u89e3\u6c7a\u3059\u308b\u3060\u3051\u3058\u3083\u306a\u304f\u3001\u65b0\u305f\u306a\u6c17\u4ed8\u304d\u3082\u767a\u898b\u3067\u304d\u308b\u3053\u3068\u3067\u3057\u3087\u3046\u3002\u304a\u60a9\u307f\u306e\u65b9\u306f\u305c\u3072\u3054\u4e00\u8aad\u304f\u3060\u3055\u3044\u3002\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/65270#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/65270\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/65270#primaryimage\",\"url\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/image27.jpg\",\"contentUrl\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/image27.jpg\",\"width\":700,\"height\":400},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/65270#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010Rails\u5165\u9580\u3011update_all\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/\",\"name\":\"\u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0\",\"description\":\"\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u5b66\u7fd2\u306e\u3059\u3079\u3066\u304c\u30b3\u30b3\u306b\u3002\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ja\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/#organization\",\"name\":\"\u682a\u5f0f\u4f1a\u793eSAMURAI\",\"url\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/logo.png\",\"contentUrl\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/logo.png\",\"width\":600,\"height\":600,\"caption\":\"\u682a\u5f0f\u4f1a\u793eSAMURAI\"},\"image\":{\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/sejuku2013\",\"https:\\\/\\\/x.com\\\/samuraijuku\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCCFOQO5aDK0xXam4cUQXT8g\\\/featured\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/#\\\/schema\\\/person\\\/d20c57b59dba15001519a8a671183095\",\"name\":\"\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d91ed20aaa7f873a0f4f35586561303460c1e3864746dddb6ebe0fb093c1952d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d91ed20aaa7f873a0f4f35586561303460c1e3864746dddb6ebe0fb093c1952d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d91ed20aaa7f873a0f4f35586561303460c1e3864746dddb6ebe0fb093c1952d?s=96&d=mm&r=g\",\"caption\":\"\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8\"},\"description\":\"\u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u587e\u306f\u300c\u4eba\u751f\u3092\u5909\u3048\u308b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u5b66\u7fd2\u300d\u3092\u30b3\u30f3\u30bb\u30f3\u30d7\u30c8\u306b\u3001\u904e\u53bb\u591a\u304f\u306e\u30d5\u30ea\u30fc\u30e9\u30f3\u30b9\u30a8\u30f3\u30b8\u30cb\u30a2\u3092\u8f29\u51fa\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb\u3067\u3059\u3002\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8\u3067\u306f\u6280\u8853\u7cfb\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u4e2d\u5fc3\u306b\u6709\u7528\u306a\u60c5\u5831\u3092\u767a\u4fe1\u3057\u3066\u3044\u304d\u307e\u3059\u3002\",\"url\":\"https:\\\/\\\/www.sejuku.net\\\/blog\\\/author\\\/samurai-tech\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010Rails\u5165\u9580\u3011update_all\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308b | \u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0","description":"\u3053\u306e\u8a18\u4e8b\u3067\u306f\u300c \u3010Rails\u5165\u9580\u3011update_all\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308b \u300d\u306b\u3064\u3044\u3066\u3001\u8ab0\u3067\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3092\u8aad\u3081\u3070\u3001\u3042\u306a\u305f\u306e\u60a9\u307f\u304c\u89e3\u6c7a\u3059\u308b\u3060\u3051\u3058\u3083\u306a\u304f\u3001\u65b0\u305f\u306a\u6c17\u4ed8\u304d\u3082\u767a\u898b\u3067\u304d\u308b\u3053\u3068\u3067\u3057\u3087\u3046\u3002\u304a\u60a9\u307f\u306e\u65b9\u306f\u305c\u3072\u3054\u4e00\u8aad\u304f\u3060\u3055\u3044\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sejuku.net\/blog\/65270","og_locale":"ja_JP","og_type":"article","og_title":"\u3010Rails\u5165\u9580\u3011update_all\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308b | \u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0","og_description":"\u3053\u306e\u8a18\u4e8b\u3067\u306f\u300c \u3010Rails\u5165\u9580\u3011update_all\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308b \u300d\u306b\u3064\u3044\u3066\u3001\u8ab0\u3067\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3092\u8aad\u3081\u3070\u3001\u3042\u306a\u305f\u306e\u60a9\u307f\u304c\u89e3\u6c7a\u3059\u308b\u3060\u3051\u3058\u3083\u306a\u304f\u3001\u65b0\u305f\u306a\u6c17\u4ed8\u304d\u3082\u767a\u898b\u3067\u304d\u308b\u3053\u3068\u3067\u3057\u3087\u3046\u3002\u304a\u60a9\u307f\u306e\u65b9\u306f\u305c\u3072\u3054\u4e00\u8aad\u304f\u3060\u3055\u3044\u3002","og_url":"https:\/\/www.sejuku.net\/blog\/65270","og_site_name":"\u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0","article_publisher":"https:\/\/www.facebook.com\/sejuku2013","article_published_time":"1970-01-01T00:00:00+00:00","article_modified_time":"2024-05-06T02:50:05+00:00","og_image":[{"width":700,"height":400,"url":"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/image27.jpg","type":"image\/jpeg"}],"author":"\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8","twitter_card":"summary_large_image","twitter_creator":"@samuraijuku","twitter_site":"@samuraijuku","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.sejuku.net\/blog\/65270#article","isPartOf":{"@id":"https:\/\/www.sejuku.net\/blog\/65270"},"author":{"name":"\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8","@id":"https:\/\/www.sejuku.net\/blog\/#\/schema\/person\/d20c57b59dba15001519a8a671183095"},"headline":"\u3010Rails\u5165\u9580\u3011update_all\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308b","datePublished":"1970-01-01T00:00:00+00:00","dateModified":"2024-05-06T02:50:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.sejuku.net\/blog\/65270"},"wordCount":138,"publisher":{"@id":"https:\/\/www.sejuku.net\/blog\/#organization"},"image":{"@id":"https:\/\/www.sejuku.net\/blog\/65270#primaryimage"},"thumbnailUrl":"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/image27.jpg","keywords":["Ruby on Rails","update_all"],"articleSection":["Ruby\u5b66\u7fd2"],"inLanguage":"ja"},{"@type":"WebPage","@id":"https:\/\/www.sejuku.net\/blog\/65270","url":"https:\/\/www.sejuku.net\/blog\/65270","name":"\u3010Rails\u5165\u9580\u3011update_all\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308b | \u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0","isPartOf":{"@id":"https:\/\/www.sejuku.net\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.sejuku.net\/blog\/65270#primaryimage"},"image":{"@id":"https:\/\/www.sejuku.net\/blog\/65270#primaryimage"},"thumbnailUrl":"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/image27.jpg","datePublished":"1970-01-01T00:00:00+00:00","dateModified":"2024-05-06T02:50:05+00:00","description":"\u3053\u306e\u8a18\u4e8b\u3067\u306f\u300c \u3010Rails\u5165\u9580\u3011update_all\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308b \u300d\u306b\u3064\u3044\u3066\u3001\u8ab0\u3067\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3092\u8aad\u3081\u3070\u3001\u3042\u306a\u305f\u306e\u60a9\u307f\u304c\u89e3\u6c7a\u3059\u308b\u3060\u3051\u3058\u3083\u306a\u304f\u3001\u65b0\u305f\u306a\u6c17\u4ed8\u304d\u3082\u767a\u898b\u3067\u304d\u308b\u3053\u3068\u3067\u3057\u3087\u3046\u3002\u304a\u60a9\u307f\u306e\u65b9\u306f\u305c\u3072\u3054\u4e00\u8aad\u304f\u3060\u3055\u3044\u3002","breadcrumb":{"@id":"https:\/\/www.sejuku.net\/blog\/65270#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sejuku.net\/blog\/65270"]}]},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.sejuku.net\/blog\/65270#primaryimage","url":"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/image27.jpg","contentUrl":"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2018\/07\/image27.jpg","width":700,"height":400},{"@type":"BreadcrumbList","@id":"https:\/\/www.sejuku.net\/blog\/65270#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sejuku.net\/blog\/"},{"@type":"ListItem","position":2,"name":"\u3010Rails\u5165\u9580\u3011update_all\u3067\u30ec\u30b3\u30fc\u30c9\u3092\u30b5\u30af\u30c3\u3068\u66f4\u65b0\u3059\u308b"}]},{"@type":"WebSite","@id":"https:\/\/www.sejuku.net\/blog\/#website","url":"https:\/\/www.sejuku.net\/blog\/","name":"\u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0","description":"\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u5b66\u7fd2\u306e\u3059\u3079\u3066\u304c\u30b3\u30b3\u306b\u3002","publisher":{"@id":"https:\/\/www.sejuku.net\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sejuku.net\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ja"},{"@type":"Organization","@id":"https:\/\/www.sejuku.net\/blog\/#organization","name":"\u682a\u5f0f\u4f1a\u793eSAMURAI","url":"https:\/\/www.sejuku.net\/blog\/","logo":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.sejuku.net\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2023\/07\/logo.png","contentUrl":"https:\/\/www.sejuku.net\/blog\/wp-content\/uploads\/2023\/07\/logo.png","width":600,"height":600,"caption":"\u682a\u5f0f\u4f1a\u793eSAMURAI"},"image":{"@id":"https:\/\/www.sejuku.net\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/sejuku2013","https:\/\/x.com\/samuraijuku","https:\/\/www.youtube.com\/channel\/UCCFOQO5aDK0xXam4cUQXT8g\/featured"]},{"@type":"Person","@id":"https:\/\/www.sejuku.net\/blog\/#\/schema\/person\/d20c57b59dba15001519a8a671183095","name":"\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/secure.gravatar.com\/avatar\/d91ed20aaa7f873a0f4f35586561303460c1e3864746dddb6ebe0fb093c1952d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d91ed20aaa7f873a0f4f35586561303460c1e3864746dddb6ebe0fb093c1952d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d91ed20aaa7f873a0f4f35586561303460c1e3864746dddb6ebe0fb093c1952d?s=96&d=mm&r=g","caption":"\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8"},"description":"\u4f8d\u30a8\u30f3\u30b8\u30cb\u30a2\u587e\u306f\u300c\u4eba\u751f\u3092\u5909\u3048\u308b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u5b66\u7fd2\u300d\u3092\u30b3\u30f3\u30bb\u30f3\u30d7\u30c8\u306b\u3001\u904e\u53bb\u591a\u304f\u306e\u30d5\u30ea\u30fc\u30e9\u30f3\u30b9\u30a8\u30f3\u30b8\u30cb\u30a2\u3092\u8f29\u51fa\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb\u3067\u3059\u3002\u4f8d\u30c6\u30c3\u30af\u7de8\u96c6\u90e8\u3067\u306f\u6280\u8853\u7cfb\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u4e2d\u5fc3\u306b\u6709\u7528\u306a\u60c5\u5831\u3092\u767a\u4fe1\u3057\u3066\u3044\u304d\u307e\u3059\u3002","url":"https:\/\/www.sejuku.net\/blog\/author\/samurai-tech"}]}},"_links":{"self":[{"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/posts\/65270","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/users\/16433"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/comments?post=65270"}],"version-history":[{"count":0,"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/posts\/65270\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/media\/65524"}],"wp:attachment":[{"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/media?parent=65270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/categories?post=65270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sejuku.net\/blog\/wp-json\/wp\/v2\/tags?post=65270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}