{"id":4458,"date":"2018-06-19T09:54:28","date_gmt":"2018-06-19T00:54:28","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=4458"},"modified":"2023-05-27T23:02:47","modified_gmt":"2023-05-27T14:02:47","slug":"%e3%80%90ruby-on-rails%e3%80%91%e3%80%8c%e3%83%a2%e3%83%87%e3%83%ab%e3%80%8d%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=4458","title":{"rendered":"\u3010Ruby on Rails\u3011YAML\u306e\u57fa\u672c\u3068\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u63a5\u7d9a\u8a2d\u5b9a\u3092\u3059\u308b\u306b\u306f\uff1f"},"content":{"rendered":"<p>YAML(\u30e4\u30e0\u30eb)\u306f\u3001Ruby on Rails\u306e\u57fa\u672c\u7684\u306a\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u5f62\u5f0f\u3067\u3059\u3002<\/p>\n<h2>YAML(\u30e4\u30e0\u30eb)\u306e\u898b\u65b9<\/h2>\n<p>YAML(\u30e4\u30e0\u30eb)\u306e\u57fa\u672c\u7684\u306a\u5f62\u5f0f\u3068\u3057\u3066\u306f\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">\u30ad\u30fc\uff1a\u5024<\/pre>\n<p>\u767e\u805e\u306f\u3001\u4e00\u898b\u306b\u3057\u304b\u305a\u306a\u306e\u3067\u3001\u5177\u4f53\u4f8b\u3092\u6319\u3052\u3066YAML\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u307f\u65b9\u3092\u899a\u3048\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>\u4f8b(config\/database.yml\u306e\u5834\u5408)<\/h2>\n<p>\u4f8b\u3048\u3070\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u63a5\u7d9a\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308b\u300cconfig\/database.yml\u300d\u306e\u5834\u5408\u3092\u4f8b\u306b\u53d6\u308a\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"lang:default decode:true\">default: &amp;default\r\n  adapter: sqlite3\r\n  pool: &lt;%= ENV.fetch(\"RAILS_MAX_THREADS\") { 5 } %&gt;\r\n  timeout: 5000\r\n\r\ndevelopment:\r\n  &lt;&lt;: *default\r\n  database: db\/development.sqlite3\r\n\r\ntest:\r\n  &lt;&lt;: *default\r\n  database: db\/test.sqlite3\r\n\r\nproduction:\r\n  &lt;&lt;: *default\r\n  database: db\/production.sqlite3\r\n\r\n<\/pre>\n<h3>\u4e00\u3064\u306e\u30ad\u30fc\u306b\u3001\u8907\u6570\u306e\u30b5\u30d6\u30ad\u30fc\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u308b\u3002<\/h3>\n<p><span style=\"color: #ff0000;\"><strong>\u300cdefault\u300d<\/strong><\/span>\u3068\u3044\u3046\u30ad\u30fc\u306b\u5bfe\u3057\u3066\u3001\u5b57\u4e0b\u3052\uff08\u30a4\u30f3\u30c7\u30f3\u30c8\uff09\u3057\u3066\u3001\u300cadapter\u300d\u3001\u300cpool\u300d\u3001\u300ctimeout\u300d\u304c\u7d9a\u3044\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>default\u3068\u3044\u3046<span style=\"color: #ff0000;\"><strong>\u4e00\u3064\u306e\u30ad\u30fc\u306b\u5bfe\u3057\u3066\u3001\u5165\u308c\u5b50\u306b\u3057\u3066\u8907\u6570\u306e\u30ad\u30fc\u3092\u8a2d\u5b9a\u3059\u308b<\/strong><\/span>\u3068\u3044\u3046\u610f\u5473\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u300c&amp;\u300d\u3092\u4f7f\u3063\u3066\u3001\u5171\u901a\u306e\u8a2d\u5b9a\u3092\u751f\u6210\u3057\u3066\u3044\u308b\u3002<\/h3>\n<p>\u300c&amp;default\u300d\u3068\u3057\u3066\u5148\u982d\u306b\u300c&amp;\u300d\u3092\u3064\u3051\u305f\u5024\u306f<span style=\"color: #ff0000;\"><strong>\u5171\u901a\u5909\u6570<\/strong><\/span>\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u5f8c\u3001<span style=\"color: #ff0000;\"><strong>\u300c&lt;&lt;: *default\u300d<\/strong><\/span>\u3068\u3059\u308b\u3053\u3068\u3067\u3001\u5171\u901a\u8a2d\u5b9a\u3092\u3001\u305d\u308c\u305e\u308c\u9069\u5fdc\u3055\u305b\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3>\u74b0\u5883\u3092\u6307\u5b9a\u3057\u3066\u3044\u308b\u3002<\/h3>\n<p>YAML\u306e\u4e2d\u3067\u4f7f\u308f\u308c\u3066\u3044\u308b\u4e0b\u8a18\u306e\u30ad\u30fc\u306f\u3001\u7279\u5225\u306a\u610f\u5473\u3092\u6301\u3063\u3066\u3044\u3066\u74b0\u5883\u306b\u3088\u3063\u3066\u9069\u5fdc\u3055\u308c\u308b\u304b\u304c\u5909\u308f\u308b\u3082\u306e\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<table>\n<tbody>\n<tr>\n<th>\u30ad\u30fc<\/th>\n<th>\u8aac\u660e<\/th>\n<\/tr>\n<tr>\n<td>development<\/td>\n<td>\u958b\u767a\u6642\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u3059\u3002\uff09<\/td>\n<\/tr>\n<tr>\n<td>test<\/td>\n<td>\u81ea\u52d5\u30c6\u30b9\u30c8\u5b9f\u884c\u6642\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002<\/td>\n<\/tr>\n<tr>\n<td>production<\/td>\n<td>\u958b\u767a\u6e08\u307f\u306eRails\u30a2\u30d7\u30ea\u3092\u672c\u756a\u4e0a\u3067\u7a3c\u52d5\u3059\u308b\u969b\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u74b0\u5883\u3092\u5909\u3048\u308b\u306b\u306f\uff1f<\/strong><\/p>\n<p>\u306a\u304a\u3001\u74b0\u5883\u3092\u5909\u66f4\u3057\u305f\u3044\u5834\u5408\u306f\u300crails s\u300d\u30b3\u30de\u30f3\u30c9\u3067\u30b5\u30fc\u30d0\u30fc\u3092\u8d77\u52d5\u3059\u308b\u969b\u306b\u3001<span style=\"color: #ff0000;\"><strong>\u300ce\u30aa\u30d7\u30b7\u30e7\u30f3\u300d<\/strong><\/span>\u3092\u3064\u3051\u3066\u74b0\u5883\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001test\u74b0\u5883\u3067\u52d5\u4f5c\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u300crails s -e test\u300d\u3068\u6307\u5b9a\u3057\u307e\u3059\u3002\uff08\u4f55\u3082\u6307\u5b9a\u3057\u306a\u304b\u3063\u305f\u5834\u5408\u306f\u3001develpment\u304c\u9069\u7528\u3055\u308c\u307e\u3059\u3002\uff09<\/p>\n<h2>config\/database.yml<\/h2>\n<p>Ruby on Rails\u3067\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u63a5\u7d9a\u3092\u6271\u3046\u969b\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u300cconfig\/database.yml\u300d<\/strong><\/span>\u306b\u3066\u8a2d\u5b9a\u3092\u3057\u307e\u3059\u3002<\/p>\n<p>Rails\u30a2\u30d7\u30ea\u3092\u300crails new\u30b3\u30de\u30f3\u30c9\u300d\u3067\u4f5c\u6210\u3057\u305f\u969b\u306b\u3001<span style=\"color: #ff0000;\"><strong>\u300c-d\u30aa\u30d7\u30b7\u30e7\u30f3\u300d<\/strong><\/span>\u3067\u4f7f\u7528\u3059\u308b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u6307\u5b9a\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>-d\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u7701\u7565\u3057\u305f\u5834\u5408\u306f\u300csqlite3\u300d\u3092\u4f7f\u3046\u3053\u3068\u3092\u524d\u63d0\u306b\u3057\u305fyml\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u3001<span style=\"color: #ff0000;\"><strong>\u300csqlite3\u300d<\/strong><\/span>\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3092\u524d\u63d0\u306b\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">[root@localhost config]# more database.yml\r\n# SQLite version 3.x\r\n#   gem install sqlite3\r\n#\r\n#   Ensure the SQLite 3 gem is defined in your Gemfile\r\n#   gem 'sqlite3'\r\n#\r\ndefault: &amp;default\r\n  adapter: sqlite3\r\n  pool: &lt;%= ENV.fetch(\"RAILS_MAX_THREADS\") { 5 } %&gt;\r\n  timeout: 5000\r\n\r\ndevelopment:\r\n  &lt;&lt;: *default\r\n  database: db\/development.sqlite3\r\n\r\n# Warning: The database defined as \"test\" will be erased and\r\n# re-generated from your development database when you run \"rake\".\r\n# Do not set this db to the same as development or production.\r\ntest:\r\n  &lt;&lt;: *default\r\n  database: db\/test.sqlite3\r\n\r\nproduction:\r\n  &lt;&lt;: *default\r\n  database: db\/production.sqlite3<\/pre>\n<h3>\u8a2d\u5b9a\u9805\u76ee<\/h3>\n<table>\n<tbody>\n<tr>\n<th>\u8a2d\u5b9a\u5024<\/th>\n<th>\u8aac\u660e<\/th>\n<\/tr>\n<tr>\n<td>adapter<\/td>\n<td>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u63a5\u7d9a\u306b\u4f7f\u7528\u3059\u308bgem<\/td>\n<\/tr>\n<tr>\n<td>pool<\/td>\n<td>\u30b3\u30cd\u30af\u30b7\u30e7\u30f3\u30d7\u30fc\u30ea\u30f3\u30b0\u3067\u4f7f\u7528\u3059\u308b\u30b3\u30cd\u30af\u30b7\u30e7\u30f3\u306e\u4e0a\u9650\u6570<\/td>\n<\/tr>\n<tr>\n<td>timeout<\/td>\n<td>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304b\u3089\u306e\u5fdc\u7b54\u5f85\u3061\u306e\u4e0a\u9650\u6642\u9593\uff08\u30df\u30ea\u79d2\uff09<\/td>\n<\/tr>\n<tr>\n<td>database<\/td>\n<td>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"color: #ff0000;\"><strong>\u30b3\u30cd\u30af\u30b7\u30e7\u30f3\u30d7\u30fc\u30ea\u30f3\u30b0<\/strong><\/span>\u306b\u3064\u3044\u3066\u306f\u3001\u4e0b\u8a18\u306e\u8a18\u4e8b\u3067\u3082\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002\uff08Tomcat\u306e\u8aac\u660e\u3067\u3059\u304c\u3001Ruby\u3067\u3082\u7528\u9014\u306f\u540c\u3058\u3067\u3059\u3002\uff09<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"m4TkKuxptv\"><p><a href=\"http:\/\/www.code-magagine.com\/?p=1295\">\u3010Java\u3011JDBC\u3092Web\u30a2\u30d7\u30ea\u3067\u4f7f\u3046\u5834\u5408\u3067\u8003\u616e\u3059\u308b\u3053\u3068\uff08\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u306a\u3069\uff09<\/a><\/p><\/blockquote>\n<p><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" src=\"http:\/\/www.code-magagine.com\/?p=1295&#038;embed=true#?secret=m4TkKuxptv\" data-secret=\"m4TkKuxptv\" width=\"500\" height=\"282\" title=\"&#8220;\u3010Java\u3011JDBC\u3092Web\u30a2\u30d7\u30ea\u3067\u4f7f\u3046\u5834\u5408\u3067\u8003\u616e\u3059\u308b\u3053\u3068\uff08\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u306a\u3069\uff09&#8221; &#8212; \u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30de\u30ac\u30b8\u30f3\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<h2>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\u3059\u308b\u306b\u306f\uff1f<\/h2>\n<p>\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308c\u3070\u3001DB\u304c\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">rails db:create<\/pre>\n<p>\u65e2\u306bRails\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u6642\u306b\u751f\u6210\u3055\u308c\u3066\u3044\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u2026\u3002<\/p>\n<h3>\u751f\u6210\u7d50\u679c<\/h3>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-4477\" src=\"http:\/\/www.code-magagine.com\/wp-content\/uploads\/2018\/06\/rails_db.png\" alt=\"\" width=\"363\" height=\"54\" srcset=\"http:\/\/www.code-magagine.com\/wp-content\/uploads\/2018\/06\/rails_db.png 363w, http:\/\/www.code-magagine.com\/wp-content\/uploads\/2018\/06\/rails_db-300x45.png 300w\" sizes=\"(max-width: 363px) 100vw, 363px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"YAML(\u30e4\u30e0\u30eb)\u306f\u3001Ruby on Rails\u306e\u57fa\u672c\u7684\u306a\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u5f62\u5f0f\u3067\u3059\u3002 YAML(\u30e4\u30e0\u30eb)\u306e\u898b\u65b9 YAML(\u30e4\u30e0\u30eb)\u306e\u57fa\u672c\u7684\u306a\u5f62\u5f0f\u3068\u3057\u3066\u306f\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002 \u30ad\u30fc\uff1a\u5024 \u767e\u805e\u306f\u3001\u4e00\u898b\u306b\u3057\u304b\u305a\u306a\u306e\u3067\u3001\u5177 [&hellip;]","protected":false},"author":1,"featured_media":4265,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[36],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/4458"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4458"}],"version-history":[{"count":12,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/4458\/revisions"}],"predecessor-version":[{"id":20553,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/4458\/revisions\/20553"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/media\/4265"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4458"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}