{"id":9680,"date":"2020-03-15T06:13:23","date_gmt":"2020-03-14T21:13:23","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=9680"},"modified":"2023-05-27T22:28:45","modified_gmt":"2023-05-27T13:28:45","slug":"%e3%80%90ruby-on-rails%e3%80%91%e3%80%8c%e3%83%95%e3%82%a3%e3%82%af%e3%82%b9%e3%83%81%e3%83%a3%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=9680","title":{"rendered":"\u3010Ruby on Rails\u3011\u300c\u30d5\u30a3\u30af\u30b9\u30c1\u30e3\u300d\u306b\u3064\u3044\u3066"},"content":{"rendered":"<h2>\u30d5\u30a3\u30af\u30b9\u30c1\u30e3\u3068\u306f\uff1f<\/h2>\n<p>Rails\u3067\u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf\u3092\u751f\u6210\u3059\u308b\u305f\u3081\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u6a5f\u80fd\u3067\u3059\u3002<\/p>\n<h2>\u30d5\u30a3\u30af\u30b9\u30c1\u30e3\u306e\u30e1\u30ea\u30c3\u30c8<\/h2>\n<ul>\n<li>\u6bd4\u8f03\u7684\u65e9\u3044<\/li>\n<li>Rails\u30c7\u30d5\u30a9\u30eb\u30c8\u6a5f\u80fd\u306e\u305f\u3081\u74b0\u5883\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u5fc5\u8981\u304c\u306a\u3044\u3002<\/li>\n<\/ul>\n<h2>\u30d5\u30a3\u30af\u30b9\u30c1\u30e3\u306e\u30c7\u30e1\u30ea\u30c3\u30c8<\/h2>\n<ul>\n<li>Rspec\u3067\u4f7f\u3046\u5834\u5408\u306f\u5916\u90e8\u30d5\u30a1\u30a4\u30eb\u306b\u30c7\u30fc\u30bf\u304c\u8a18\u8ff0\u3055\u308c\u308b\u306e\u3067\u5225\u30d5\u30a1\u30a4\u30eb\u306e\u5185\u5bb9\u3092\u30c6\u30b9\u30c8\u6642\u306b\u899a\u3048\u3066\u304a\u304b\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3002<\/li>\n<li>\u30c7\u30fc\u30bf\u3092\u53d6\u308a\u8fbc\u3080\u969b\u306bActiveRecord\u3092\u4f7f\u308f\u306a\u3044\u306e\u3067\u30e2\u30c7\u30eb\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u7b49\u306e\u6a5f\u80fd\u306e\u30c6\u30b9\u30c8\u3092\u884c\u3048\u306a\u3044\u3002<\/li>\n<li>\u30c7\u30fc\u30bf\u304c\u8106\u3044\u305f\u3081\u4fdd\u5b88\u306b\u6642\u9593\u3092\u304b\u3051\u306a\u3044\u3068\u3044\u3051\u306a\u304f\u306a\u308b\u3002<\/li>\n<\/ul>\n<h2>\u30d5\u30a3\u30af\u30b9\u30c1\u30e3\u306e\u5834\u6240\uff08\u4f8b\uff09<\/h2>\n<p>\u4e0b\u8a18\u306e\u5834\u6240\u306bYAML\u5f62\u5f0f\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u7528\u610f\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">test\/fixtures\/users.yml<\/pre>\n<h2>\u30d5\u30a3\u30af\u30b9\u30c1\u30e3\u306e\u69cb\u6587\uff08\u4f8b\uff09<\/h2>\n<pre class=\"lang:default decode:true \"># Read about fixtures at http:\/\/api.rubyonrails.org\/classes\/ActiveRecord\/FixtureSet.html\r\n \r\none:\r\n  name: MyText\r\n \r\ntwo:\r\n  name: MyText<\/pre>\n<h2>Rspec\u304b\u3089\u306e\u547c\u3073\u51fa\u3057<\/h2>\n<p>\u4f8b\u3048\u3070\u4e0a\u306e\u4f8b\u3067\u8a00\u3048\u3070Rspec\u306e\u30b9\u30da\u30c3\u30af\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u30d5\u30a3\u30af\u30b9\u30c1\u30e3\u30c7\u30fc\u30bf\u3092\u547c\u3073\u51fa\u3059\u969b\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">users(:one)<\/pre>\n<h2>\u30d5\u30a3\u30af\u30b9\u30c1\u30e3\u306e\u53d6\u308a\u8fbc\u307f<\/h2>\n<p>\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u30c6\u30b9\u30c8\u74b0\u5883\u306b\u30d5\u30a3\u30af\u30b9\u30c1\u30e3\u3067\u7528\u610f\u3057\u305f\u30c7\u30fc\u30bf\u304c\u53d6\u308a\u8fbc\u307e\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">rails db:fixtures:load<\/pre>\n<p>\u306a\u304a\u3001\u65e2\u5b58\u30c7\u30fc\u30bf\u306f\u5168\u3066\u524a\u9664\u3055\u308c\u3066fixtures\u3067\u7528\u610f\u3057\u305f\u30c7\u30fc\u30bf\u306b\u5b8c\u5168\u306b\u5dee\u3057\u5909\u308f\u308b\u306e\u3067\u5b9f\u884c\u306b\u306f\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<h2>seed\u3068\u306e\u9055\u3044<\/h2>\n<p>fixture\u3082seed\u3082\u3069\u3061\u3089\u3082\u30c7\u30fc\u30bf\u3092\u7528\u610f\u3059\u308b\u6a5f\u80fd\u306b\u306a\u308a\u307e\u3059\u304c\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u4f7f\u3044\u5206\u3051\u307e\u3059\u3002<\/p>\n<h3>fixture<\/h3>\n<p>\u30c6\u30b9\u30c8\u7528\u306b\u767b\u9332\u3059\u308b\u30c7\u30fc\u30bf\u306e\u305f\u3081\u306b\u4f7f\u3044\u307e\u3059\u3002(\u307e\u305f\u3001\u73fe\u5834\u306b\u3088\u3063\u3066\u306ffixture\u3067\u306f\u306a\u304ffactoryGirl\u306a\u3069\u3092\u4f7f\u3063\u3066\u3044\u308b\u73fe\u5834\u306f\u3042\u308a\u307e\u3059\u3002\uff09<\/p>\n<p>\u300c\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u300d\u3068\u300c\u901a\u5e38\u5229\u7528\u30c7\u30fc\u30bf\u300d\u3092\u6df7\u5728\u3055\u305b\u3066\u3044\u308b\u3068\u3069\u3061\u3089\u304b\u306e\u30c7\u30fc\u30bf\u3092\u4fee\u6b63\u3057\u305f\u969b\u306b\u30c6\u30b9\u30c8\u5b9f\u884c\u306b\u3082\u5f71\u97ff\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u306e\u3067\u305d\u308c\u3092\u9632\u6b62\u3059\u308b\u305f\u3081\u306b\u5225\u9014\u30c6\u30b9\u30c8\u7528\u306e\u30c7\u30fc\u30bf\u3068\u3057\u3066fixture\u3068\u3044\u3046\u6a5f\u80fd\u304c\u3042\u308b\u30a4\u30e1\u30fc\u30b8\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>seed<\/h3>\n<p>\u30de\u30b9\u30bf\u30c7\u30fc\u30bf\u3092\u521d\u671f\u767b\u9332\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u90e8\u7f72\u30c6\u30fc\u30d6\u30eb\u306a\u3069\u304c\u3042\u3063\u305f\u5834\u5408\u306e\u521d\u671f\u30c7\u30fc\u30bf\u306a\u3069\u3002\u306a\u306e\u3067\u3001\u672c\u756a\u30c7\u30fc\u30bf\u306e\u6295\u5165\u306b\u3082\u666e\u901a\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001development\u3084production\u306a\u3069\u74b0\u5883\u3054\u3068\u306b\u7528\u610f\u3059\u308b\u3053\u3068\u304c\u666e\u901a\u3067\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001\u958b\u767a\u73fe\u5834\u306b\u3088\u3063\u3066\u306f\u5168\u304fseed\u3092\u4f7f\u3063\u3066\u3044\u306a\u3044\u73fe\u5834\u3082\u3044\u307e\u3059\u3002\u958b\u767a\u62c5\u5f53\u3068DB\u62c5\u5f53\u304c\u5206\u304b\u308c\u3066\u3044\u308b\u73fe\u5834\u306b\u591a\u304f\u305d\u306e\u5834\u5408Rails\u7ba1\u7406\u5916\u306eDB\u30c4\u30fc\u30eb\u306a\u3069\u3092\u4f7f\u7528\u3057\u3066CSV\u30a4\u30f3\u30dd\u30fc\u30c8\u306a\u3069\u3092\u3057\u3066\u3044\u305f\u308a\u3082\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u30d5\u30a3\u30af\u30b9\u30c1\u30e3\u3068\u306f\uff1f Rails\u3067\u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf\u3092\u751f\u6210\u3059\u308b\u305f\u3081\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u6a5f\u80fd\u3067\u3059\u3002 \u30d5\u30a3\u30af\u30b9\u30c1\u30e3\u306e\u30e1\u30ea\u30c3\u30c8 \u6bd4\u8f03\u7684\u65e9\u3044 Rails\u30c7\u30d5\u30a9\u30eb\u30c8\u6a5f\u80fd\u306e\u305f\u3081\u74b0\u5883\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u5fc5\u8981\u304c\u306a\u3044\u3002 \u30d5\u30a3\u30af\u30b9\u30c1\u30e3\u306e\u30c7\u30e1\u30ea\u30c3\u30c8 Rspe [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[82,36],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/9680"}],"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=9680"}],"version-history":[{"count":7,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/9680\/revisions"}],"predecessor-version":[{"id":20460,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/9680\/revisions\/20460"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9680"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}