{"id":3467,"date":"2023-08-11T18:36:39","date_gmt":"2023-08-11T09:36:39","guid":{"rendered":"https:\/\/www.kinryo.net\/?p=3467"},"modified":"2023-08-14T06:36:19","modified_gmt":"2023-08-13T21:36:19","slug":"%ef%bc%93%ef%bc%9a%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab%e7%b6%9a%e3%81%8d%ef%bc%92","status":"publish","type":"post","link":"https:\/\/www.kinryo.net\/?p=3467","title":{"rendered":"\uff13\uff1a\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u7d9a\u304d\uff12"},"content":{"rendered":"\r\n<p>toy\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u308b<br \/><span><span style=\"color: #ff6600;\">$<\/span> <span style=\"color: #008000;\">c<\/span><\/span><span style=\"color: #008000;\">d ..<\/span><br \/><span style=\"color: #ff6600;\">$ <\/span><span style=\"color: #008000;\">rails 7.0.6 new toy_app &#8211;skip-bundle<\/span><br \/><span style=\"color: #ff6600;\">$ <\/span><span style=\"color: #008000;\">cd toy_app\/<br \/><span style=\"color: #333333;\">Gemfile\u7de8\u96c6<\/span><br \/><span style=\"color: #ff6600;\">$<\/span> gedit Gemfile <br \/><\/span><span style=\"color: #0000ff;\">source &#8220;https:\/\/rubygems.org&#8221;<\/span><br \/><span style=\"color: #0000ff;\">git_source(:github) { |repo| &#8220;https:\/\/github.com\/#{repo}.git&#8221; }<\/span><\/p>\r\n<p><span style=\"color: #0000ff;\">ruby &#8220;3.2.2&#8221;<\/span><\/p>\r\n<p><span style=\"color: #0000ff;\">gem &#8220;rails&#8221;, &#8220;7.0.6&#8221;<\/span><br \/><span style=\"color: #0000ff;\">gem &#8220;sassc-rails&#8221;, &#8220;2.1.2&#8221;<\/span><br \/><span style=\"color: #0000ff;\">gem &#8220;sprockets-rails&#8221;, &#8220;3.4.2&#8221;<\/span><br \/><span style=\"color: #0000ff;\">gem &#8220;importmap-rails&#8221;, &#8220;1.1.0&#8221;<\/span><br \/><span style=\"color: #0000ff;\">gem &#8220;turbo-rails&#8221;, &#8220;1.1.1&#8221;<\/span><br \/><span style=\"color: #0000ff;\">gem &#8220;stimulus-rails&#8221;, &#8220;1.0.4&#8221;<\/span><br \/><span style=\"color: #0000ff;\">gem &#8220;jbuilder&#8221;, &#8220;2.11.5&#8221;<\/span><br \/><span style=\"color: #0000ff;\">gem &#8220;puma&#8221;, &#8220;5.6.4&#8221;<\/span><br \/><span style=\"color: #0000ff;\">gem &#8220;bootsnap&#8221;, &#8220;1.12.0&#8221;, require: false<\/span><br \/><span style=\"color: #0000ff;\">gem &#8220;sqlite3&#8221;, &#8220;1.4.2&#8221;<\/span><\/p>\r\n<p><span style=\"color: #0000ff;\">group :development, :test do<\/span><br \/><span style=\"color: #0000ff;\">gem &#8220;debug&#8221;, &#8220;1.5.0&#8221;, platforms: %i[ mri mingw x64_mingw ]<\/span><br \/><span style=\"color: #0000ff;\">end<\/span><\/p>\r\n<p><span style=\"color: #0000ff;\">group :development do<\/span><br \/><span style=\"color: #0000ff;\">gem &#8220;web-console&#8221;, &#8220;4.2.0&#8221;<\/span><br \/><span style=\"color: #0000ff;\">end<\/span><\/p>\r\n<p><span style=\"color: #0000ff;\">group :test do<\/span><br \/><span style=\"color: #0000ff;\">gem &#8220;capybara&#8221;, &#8220;3.37.1&#8221;<\/span><br \/><span style=\"color: #0000ff;\">gem &#8220;selenium-webdriver&#8221;, &#8220;4.2.0&#8221;<\/span><br \/><span style=\"color: #0000ff;\">gem &#8220;webdrivers&#8221;, &#8220;5.0.0&#8221;<\/span><br \/><span style=\"color: #0000ff;\">end<\/span><\/p>\r\n<p><span style=\"color: #008000;\"><span style=\"color: #333333;\">gem\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3001\u30ed\u30c3\u30af\u3059\u308b<br \/><span style=\"color: #ff6600;\">$<\/span> <span style=\"color: #008000;\">bundle _2.3.14_ install<\/span><\/span><br \/><span style=\"color: #ff6600;\">$<\/span> bundle _2.3.14_ lock &#8211;add-platform x86_64-linux<br \/><\/span>hello\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3057\u3001\u30eb\u30fc\u30c8\u306e\u8a2d\u5b9a<span style=\"color: #008000;\"><br \/><span style=\"color: #ff6600;\">$<\/span> gedit app\/controllers\/application_controller.rb<br \/><span style=\"color: #0000ff;\">class ApplicationController &lt; ActionController::Base<\/span><br \/><span style=\"color: #0000ff;\">\u00a0 def hello<\/span><br \/><span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0 render html: &#8220;Toy_app hello, world!&#8221;<\/span><br \/><span style=\"color: #0000ff;\">\u00a0 end<\/span><br \/><span style=\"color: #0000ff;\">end<br \/><\/span><\/span><span style=\"color: #008000;\"><span style=\"color: #0000ff;\"><\/span><\/span><span style=\"color: #008000;\"><span style=\"color: #ff6600;\">$<\/span> gedit config\/routes.rb<br \/><span style=\"color: #0000ff;\">Rails.application.routes.draw do<\/span><br \/><span style=\"color: #0000ff;\">\u00a0 root &#8216;application#hello&#8217;<\/span><br \/><span style=\"color: #0000ff;\">end<\/span><br \/><\/span><\/p>\r\n<p>\u3067\u3082\u3046\u4e00\u3064\u306b\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u8d77\u52d5\u3057\u3066\u3044\u308b\u30b5\u30fc\u30d0\u30fc\u3092ctrl+c\u3067\u6b62\u3081\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u3092\u5909\u66f4\u3057\u3001\u30b5\u30fc\u30d0\u30fc\u3092\u8d77\u52d5<br \/><span style=\"color: #ff6600;\">$<\/span> <span style=\"color: #008000;\">cd ..<\/span><br \/><span style=\"color: #ff6600;\">$<\/span> <span style=\"color: #008000;\">cd toy_app<\/span><br \/><span style=\"color: #ff6600;\">$<\/span> <span style=\"color: #008000;\">rails s<\/span><br \/>\u3067localhost:3000 \u3067<span>Toy_app hello, world<\/span>!\u3068\u8868\u793a\u3055\u308c\u308b\u7b48<\/p>\r\n<p>\u5143\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u306b\u623b\u308agit init, add, commit\u3092\u884c\u3046<br \/><span style=\"color: #ff6600;\">$<\/span> <span style=\"color: #008000;\">git init<\/span><br \/><span style=\"color: #ff6600;\">Reinitialized existing Git repository in \/Rails\/environment\/toy_app\/.git\/<\/span><br \/><span style=\"color: #ff6600;\">$<\/span> <span style=\"color: #008000;\">git add -A<\/span><br \/><span style=\"color: #ff6600;\">$<\/span> <span style=\"color: #008000;\">git commit -m &#8220;Add hello&#8221;<\/span><\/p>\r\n<p><span class=\"hll\">scaffold\u3092\u4f7f\u3044User \u30c7\u30fc\u30bf\u30fc\u30d9\u30fc\u30b9\u3092\u4f5c\u6210<br \/><span style=\"color: #ff6600;\">$<\/span> <span style=\"color: #008000;\">rails generate scaffold User name:string email:string<\/span><br \/>\u8272\u3005\u8ffd\u52a0\u3055\u308c\u308b\u304c\u3001\u3053\u306e\u610f\u5473\u306f\u30c7\u30fc\u30d9\u30fc\u30b9\u540d\u3092User\u3068\u3057\u3001\u30c6\u30fc\u30d6\u30ebname\u3068email\u3092\u6587\u5b57\u5217\u3068\u3057\u3066\u4f5c\u6210\u3001\u7d9a\u3044\u3066\u30c7\u30fc\u30bf\u30fc\u30d9\u30fc\u30b9\u3092\u30de\u30a4\u30b0\u30ec\u30fc\u30c8\u3059\u308b<br \/><span style=\"color: #ff6600;\">$ <\/span><span style=\"color: #008000;\">rails db:migrate<\/span><br \/><span style=\"color: #ff6600;\">== 20230811074601 CreateUsers: migrating ========<\/span><br \/><span style=\"color: #ff6600;\">&#8212; create_table(:users)<\/span><br \/><span style=\"color: #ff6600;\">\u00a0\u00a0 -&gt; 0.0022s<\/span><br \/><span style=\"color: #ff6600;\">== 20230811074601 CreateUsers: migrated (0.0022s) ===<\/span><br \/>\u3053\u3053\u3067\u3001\u30d6\u30e9\u30a6\u30b6\u304b\u3089 localhost:3000\/users\u3068\u3059\u308b\u3068<br \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-11-16-56-53.png\" alt=\"\" class=\"alignnone size-full wp-image-3476\" width=\"415\" height=\"261\" srcset=\"https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-11-16-56-53.png 415w, https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-11-16-56-53-300x189.png 300w, https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-11-16-56-53-150x94.png 150w\" sizes=\"auto, (max-width: 415px) 100vw, 415px\" \/><br \/>\u3068\u8868\u793a\u3055\u308c\u308b\u7b48\u3001New user\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u51fa\u6765\u308b\u306e\u3067\u8a66\u3059\u3002<br \/><br \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-11-17-26-27-1.png\" alt=\"\" class=\"alignnone size-full wp-image-3479\" width=\"357\" height=\"411\" srcset=\"https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-11-17-26-27-1.png 357w, https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-11-17-26-27-1-261x300.png 261w, https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-11-17-26-27-1-130x150.png 130w\" sizes=\"auto, (max-width: 357px) 100vw, 357px\" \/><br \/>email\u306f\u308f\u3056\u3068\u6b63\u3057\u304f\u306a\u3044\uff08@\u304c\u7121\u3044\uff09\u3082\u306e\u3092\u5165\u529b\u3057\u3001Create User\u3092\u30af\u30ea\u30c3\u30af\u3057\u4fdd\u5b58(\u691c\u8a3c\u3092\u3057\u3066\u3044\u306a\u3044\u306e\u3067\uff09\u3002\u4fdd\u5b58\u51fa\u6765\u3066\u3057\u307e\u3046<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-11-18-07-34.png\" alt=\"\" class=\"alignnone size-full wp-image-3480\" width=\"375\" height=\"315\" srcset=\"https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-11-18-07-34.png 375w, https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-11-18-07-34-300x252.png 300w, https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-11-18-07-34-150x126.png 150w\" sizes=\"auto, (max-width: 375px) 100vw, 375px\" \/><br \/>\u4e0a\u306e\u753b\u50cf\u304c\u4fdd\u5b58\u5f8c\u306e\u3082\u306e\u3001\u30e1\u30c1\u30e3\u30af\u30c1\u30e3\u306aemail\u304c\u767b\u9332\u3055\u308c\u3066\u3044\u308b\u3002\u4e0b\u306e\u65b9\u306e\u30ea\u30f3\u30af\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001\u305d\u306e\u5185\u5bb9\u306e\u753b\u9762\u306b\u306a\u308b\u3002\u30d6\u30e9\u30a6\u30b6\u306b http:\/\/localhost:3000\/users\/new\u3068\u5165\u529b\u3057\u3001\u3082\u3046\u4e00\u4eba\u4f5c\u308a\u4fdd\u5b58\u3057\u3001http:\/\/localhost:3000\/users\/\u3068\u5165\u529b\u3059\u308b\u3068<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-11-18-30-51.png\" alt=\"\" class=\"alignnone size-full wp-image-3481\" width=\"363\" height=\"496\" srcset=\"https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-11-18-30-51.png 363w, https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-11-18-30-51-220x300.png 220w, https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-11-18-30-51-110x150.png 110w\" sizes=\"auto, (max-width: 363px) 100vw, 363px\" \/><br \/>2\u4eba\u5206\u306e\u30ea\u30b9\u30c8\u304c\u8868\u793a\u3055\u308c\u308b\u3002\u5f8c\u3001\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306b\u3042\u308b\u3088\u3046\u306b\u524a\u9664\u306a\u3069\u3092\u3084\u3063\u3066\u307f\u308b\u3002<br \/><\/span><\/p>\r\n<p>\u30eb\u30fc\u30c8\u3092\u8a2d\u5b9a\u3059\u308b<br \/><span style=\"color: #ff6600;\">$<\/span> <span style=\"color: #008000;\">gedit config\/routes.rb<\/span><br \/><span style=\"color: #ff6600;\">Rails.application.routes.draw do<\/span><br \/><span style=\"color: #ff6600;\">\u00a0 resources :users<\/span><br \/><span style=\"color: #ff6600;\">\u00a0 root &#8216;users#index&#8217;<\/span><br \/><span style=\"color: #ff6600;\">end<\/span> <br \/>\u305d\u3057\u3066\u3001app\/controllers\/users_controller.rb\u3092\u898b\u3066\u307f\u308b\u3068<br \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-12-05-22-24.png\" alt=\"\" class=\"alignnone size-full wp-image-3485\" width=\"796\" height=\"846\" srcset=\"https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-12-05-22-24.png 796w, https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-12-05-22-24-282x300.png 282w, https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-12-05-22-24-141x150.png 141w\" sizes=\"auto, (max-width: 796px) 100vw, 796px\" \/><br \/>\u4e0b\u306e\u65b9\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u306a\u3044\u304c\u3001<span class=\"hll\">scaffold\u306b\u3088\u308a index, show\u306a\u3069\u304c\u81ea\u52d5\u7684\u306b\u51fa\u6765\u3066\u3044\u308b\u3002<br \/><\/span><\/p>\r\n<p>Microposts\u30ea\u30bd\u30fc\u30b9\u3082scaffold\u3067\u30b3\u30fc\u30c9\u3092\u751f\u6210<br \/><span style=\"color: #ff6600;\">$<\/span> rails generate scaffold Micropost content:text user_id:integer<br \/>\u30c7\u30fc\u30bf\u30fc\u30d9\u30fc\u30b9\u3092\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3<br \/><span style=\"color: #ff6600;\">$<\/span> rails db:migrate<br \/><span style=\"color: #ff6600;\">== 20230813055824 CreateMicroposts: migrating =========<\/span><br \/><span style=\"color: #ff6600;\">&#8212; create_table(:microposts)<\/span><br \/><span style=\"color: #ff6600;\">\u3000\u3000-&gt; 0.0019s<\/span><br \/><span style=\"color: #ff6600;\">== 20230813055824 CreateMicroposts: migrated (0.0019s) ===========<\/span><br \/><span style=\"color: #ff6600;\">config\/routes.rb\u3092\u958b\u3044\u3066\u307f\u308b\u3068<\/span><br \/><span style=\"color: #ff6600;\">$<\/span> cat config\/routes.rb<br \/><span style=\"color: #ff6600;\">Rails.application.routes.draw do<\/span><br \/><span style=\"color: #ff6600;\">\u00a0\u00a0 resources :microposts<\/span>\u3000\u3000\u3000\u3000\u2190 \u8ffd\u52a0\u3055\u308c\u3066\u3044\u308b<br \/>\u00a0\u00a0 <span style=\"color: #ff6600;\">resources :users<\/span><br \/><span style=\"color: #ff6600;\">\u00a0\u00a0 root &#8216;users#index&#8217;<\/span><br \/><span style=\"color: #ff6600;\">end<\/span><br \/>\u307e\u305f\u3001app\/controllers\/microposts_controller.rb\u3082\u8ffd\u52a0\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u30d6\u30e9\u30a6\u30b6\u306b http:\/\/localhost:3000\/microposts\/new\u3068\u5165\u529b\u3057\u30de\u30a4\u30af\u30ed\u30dd\u30b9\u30c8\u3092\u65b0\u898f\u306b\u4f5c\u3063\u3066\u898b\u308b<br \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-13-15-23-25.png\" alt=\"\" class=\"alignnone size-full wp-image-3490\" width=\"508\" height=\"421\" srcset=\"https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-13-15-23-25.png 508w, https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-13-15-23-25-300x249.png 300w, https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-13-15-23-25-150x124.png 150w\" sizes=\"auto, (max-width: 508px) 100vw, 508px\" \/><br \/>\u305d\u3057\u3066Create Micropost\u3092\u30af\u30ea\u30c3\u30af\u3057\u3001\u4f5c\u6210\u3059\u308b\u3068<br \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-13-15-26-36.png\" alt=\"\" class=\"alignnone size-full wp-image-3491\" width=\"348\" height=\"309\" srcset=\"https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-13-15-26-36.png 348w, https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-13-15-26-36-300x266.png 300w, https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-13-15-26-36-150x133.png 150w\" sizes=\"auto, (max-width: 348px) 100vw, 348px\" \/><br \/>\u3068\u3001\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001user\u306e\u6642\u3068\u540c\u3058\u3088\u3046\u306b\u3044\u304f\u3064\u304b\u4f5c\u3063\u3066\u3001index,show destory\u306a\u3069\u3092\u3084\u3063\u3066\u307f\u308b\u3002<br \/>\u7570\u306a\u308b\u30c7\u30fc\u30bf\u30e2\u30c7\u30eb\u540c\u58eb\u306e\u95a2\u9023\u4ed8\u3051\u3092\u3084\u3063\u3066\u3044\u304f\u304c\u3001user\u306f\u8907\u6570\u306emicropost\u3092\u6301\u3066\u308b\u3057\u3001micorpost\u306fuser\u304c\u6301\u3063\u3066\u3044\u308b\u306e\u3067<br \/><span style=\"color: #ff6600;\">$<\/span> <span style=\"color: #008000;\">gedit app\/models\/user.rb<br \/><\/span> <span style=\"color: #ff6600;\">class User &lt; ApplicationRecord<\/span><br \/><span style=\"color: #ff6600;\">\u00a0 has_many :microposts<\/span><br \/><span style=\"color: #ff6600;\">end<\/span><br \/><span class=\"k\"><\/span><span style=\"color: #ff6600;\">$<\/span> <span style=\"color: #008000;\">gedit app\/models\/micropost.rb<\/span> <br \/><span style=\"color: #ff6600;\">class Micropost &lt; ApplicationRecord<\/span><br \/><span style=\"color: #ff6600;\">\u00a0 belongs_to :user<br \/>style=&#8221;color: #ff6600;&#8221;&gt;end<\/span><br \/>\u307e\u305f\u3001\u3053\u308c\u307e\u3067\u306f\u30c7\u30fc\u30bf\u30fc\u30d9\u30fc\u30b9\u306b\u5165\u529b\u3055\u308c\u308b\u30c7\u30fc\u30bf\u30fc\u306e\u691c\u8a3c\u3092\u4e00\u5207\u3084\u3063\u3066\u306a\u3044\u306e\u3067\u3001\u5236\u9650\u3084\u691c\u8a3c\u3092\u3084\u3063\u3066\u3044\u304f\u3002\u5148\u305a\u306f<span class=\"description\">\u30de\u30a4\u30af\u30ed\u30dd\u30b9\u30c8\u306e\u6700\u5927\u6587\u5b57\u6570\u3092140\u6587\u5b57\u306b\u5236\u9650\u3059\u308b<\/span><br \/><span style=\"color: #ff6600;\">$<\/span> <span style=\"color: #008000;\">gedit app\/models\/micropost.rb<\/span><br \/><span style=\"color: #ff6600;\">class Micropost &lt; ApplicationRecord<\/span><br \/><span style=\"color: #ff6600;\">\u00a0 validates :content, length: { maximum: 140 }<\/span><br \/><span style=\"color: #ff6600;\">end<\/span><br \/>\u305d\u3057\u3066\u3001micropost\u306b\uff11\uff14\uff10\u6587\u5b57\u4ee5\u4e0a\u3092\u5165\u529b\u3057\u3066\u3069\u3046\u306a\u308b\u304b\u8a66\u3059\u3002<br \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-13-16-04-19.png\" alt=\"\" class=\"alignnone size-full wp-image-3492\" width=\"634\" height=\"514\" srcset=\"https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-13-16-04-19.png 634w, https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-13-16-04-19-300x243.png 300w, https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-13-16-04-19-150x122.png 150w\" sizes=\"auto, (max-width: 634px) 100vw, 634px\" \/><br \/>141\u6587\u5b57\u5165\u308c\u308b\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308b(\u3053\u306e\u6587\u5b57\u6570\u306f\u5168\u89d2\u3067\u3082\uff11\uff14\uff11\u6587\u5b57\u306e\u69d8\u3060\u3001\u5168\u89d21\u6587\u5b57\u306f\u3084\u306f\u308a1\u6587\u5b57\u3068\u6570\u3048\u308b\uff09<br \/>\u6b21\u306fuser,email\u3092\u7a7a\u767d\u306b\u3057\u305f\u3089\u30a8\u30e9\u30fc\u3092\u51fa\u3059<br \/><span style=\"color: #ff6600;\">$<\/span> <span style=\"color: #008000;\">gedit app\/models\/user.rb<\/span><br \/><span style=\"color: #ff6600;\">class User &lt; ApplicationRecord<\/span><br \/><span style=\"color: #ff6600;\">\u00a0 has_many :microposts<\/span><br \/><span style=\"color: #ff6600;\">\u00a0 validates :name, presence: true<\/span><br \/><span style=\"color: #ff6600;\">\u00a0 validates :email, presence: true<\/span><br \/><span style=\"color: #ff6600;\">end<br \/><span style=\"color: #333333;\">\u305d\u3057\u3066\u3001\u30d6\u30e9\u30a6\u30b6\u306buser, micropost\u3092\u7a7a\u6b04\u306b\u3057\u3066Create User\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068<\/span><\/span><br \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-14-06-13-10.png\" alt=\"\" class=\"alignnone size-full wp-image-3498\" width=\"571\" height=\"510\" srcset=\"https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-14-06-13-10.png 571w, https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-14-06-13-10-300x268.png 300w, https:\/\/www.kinryo.net\/wp-content\/uploads\/2023\/08\/Screenshot-from-2023-08-14-06-13-10-150x134.png 150w\" sizes=\"auto, (max-width: 571px) 100vw, 571px\" \/><br \/>\u3068\u30a8\u30e9\u30fc\u304c\u8868\u793a\u3055\u308c\u308b<\/p>\r\n<p>\u305d\u3057\u3066git\u306b\u30b3\u30df\u30c3\u30c8<br \/><span style=\"color: #ff6600;\">$<\/span> <span style=\"color: #008000;\">git status<\/span><br \/><span style=\"color: #ff6600;\">On branch main<\/span><br \/><span style=\"color: #ff6600;\">Changes not staged for commit:<\/span><br \/><span style=\"color: #ff6600;\">\u3000(use &#8220;git add &lt;file&gt;&#8230;&#8221; to update what will be committed)<\/span><br \/><span style=\"color: #ff6600;\">\u3000(use &#8220;git restore &lt;file&gt;&#8230;&#8221; to discard changes in working directory)<\/span><br \/><span style=\"color: #ff6600;\">\u3000modified: config\/routes.rb<br \/>\u3000\u5f8c\u7565<br \/>$<\/span> <span style=\"color: #008000;\">git add -A<\/span><br \/><span style=\"color: #ff6600;\">$<\/span> <span style=\"color: #008000;\">git commit -m &#8220;Finish toy app&#8221;<\/span><br \/><span style=\"color: #ff6600;\">[main e33fc8d] Finish toy app<\/span><br \/><span style=\"color: #ff6600;\">36 files changed, 589 insertions(+), 1 deletion(-)<\/span><br \/><span style=\"color: #ff6600;\">create mode 100644 app\/controllers\/microposts_controller.rb<\/span><br \/><span style=\"color: #ff6600;\">create mode 100644 app\/controllers\/users_controller.rb<\/span><br \/><span style=\"color: #ff6600;\">create mode 100644 app\/helpers\/microposts_helper.rb<\/span><br \/><br \/><\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>toy\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u308b$ cd ..$ rails 7.0.6 new toy_app &#8211;skip-bundle$ cd toy_app\/Gemfile\u7de8\u96c6$ gedit Gemfile source  &hellip; <a href=\"https:\/\/www.kinryo.net\/?p=3467\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"vkexunit_cta_each_option":"","footnotes":""},"categories":[28],"tags":[],"class_list":["post-3467","post","type-post","status-publish","format-standard","hentry","category-ruby-on-rails-almalinux9"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.kinryo.net\/index.php?rest_route=\/wp\/v2\/posts\/3467","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kinryo.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kinryo.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kinryo.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kinryo.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3467"}],"version-history":[{"count":19,"href":"https:\/\/www.kinryo.net\/index.php?rest_route=\/wp\/v2\/posts\/3467\/revisions"}],"predecessor-version":[{"id":3499,"href":"https:\/\/www.kinryo.net\/index.php?rest_route=\/wp\/v2\/posts\/3467\/revisions\/3499"}],"wp:attachment":[{"href":"https:\/\/www.kinryo.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3467"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kinryo.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3467"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kinryo.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3467"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}