{"id":29,"date":"2023-05-07T20:11:17","date_gmt":"2023-07-17T13:15:03","guid":{"rendered":"https:\/\/www.silicloud.com\/ja\/blog\/index.php\/2023\/11\/30\/ubuntu-22-04%e3%81%a7ruby-on-rails%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/"},"modified":"2025-07-31T13:30:40","modified_gmt":"2025-07-31T04:30:40","slug":"ubuntu-22-04%e3%81%a7ruby-on-rails%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%a7ruby-on-rails%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/","title":{"rendered":"Ubuntu 22.04\u3067Ruby on Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u306e\u65b9\u6cd5"},"content":{"rendered":"<h3>\u3053\u3093\u306b\u3061\u306f\u3001\u521d\u3081\u307e\u3057\u3066\u3002<\/h3>\n<p>Ruby\u3067\u66f8\u304b\u308c\u305fWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306eRails\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u958b\u767a\u306b\u304a\u3044\u3066\u5171\u901a\u306e\u76ee\u6a19\u304c\u3042\u308b\u5834\u5408\u3001\u4e00\u8cab\u6027\u306e\u3042\u308b\u30a2\u30d7\u30ed\u30fc\u30c1\u3092\u53d6\u308a\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u3001Rails\u306f\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3001\u72b6\u614b\u7ba1\u7406\u3001\u30a2\u30bb\u30c3\u30c8\u7ba1\u7406\u306a\u3069\u306e\u51e6\u7406\u306b\u95a2\u3059\u308b\u898f\u7d04\u3092\u63d0\u4f9b\u3057\u3001\u307b\u3068\u3093\u3069\u306eWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u5fc5\u8981\u3068\u3059\u308b\u57fa\u672c\u6a5f\u80fd\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002<\/p>\n<p>\u30ec\u30a4\u30eb\u30ba\u306f\u30e2\u30c7\u30eb\u30d3\u30e5\u30fc\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\uff08MVC\uff09\u306e\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u30d1\u30bf\u30fc\u30f3\u306b\u5f93\u3063\u3066\u304a\u308a\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u8ad6\u7406\u3092\u30e2\u30c7\u30eb\u306b\u914d\u7f6e\u3057\u3001\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3084\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u60c5\u5831\u306e\u8868\u793a\u304b\u3089\u5206\u96e2\u3057\u307e\u3059\u3002\u3053\u306e\u7d44\u7e54\u7684\u306a\u69cb\u9020\u306f\u3001\u958b\u767a\u8005\u304c\u30b3\u30fc\u30c9\u3092\u30d8\u30eb\u30d1\u30fc\u3084\u30d1\u30fc\u30b7\u30e3\u30eb\u306b\u62bd\u51fa\u3059\u308b\u3053\u3068\u3092\u53ef\u80fd\u306b\u3059\u308b\u4ed6\u306e\u898f\u7d04\u3068\u5171\u306b\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b3\u30fc\u30c9\u304c\u4e0d\u5fc5\u8981\u306b\u7e70\u308a\u8fd4\u3055\u308c\u308b\u3053\u3068\u3092\u9632\u304e\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u30b5\u30e1\u3084\u305d\u306e\u884c\u52d5\u306b\u95a2\u3059\u308b\u60c5\u5831\u3092\u6295\u7a3f\u3067\u304d\u308bRails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u3053\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306f\u3001\u5c06\u6765\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306e\u51fa\u767a\u70b9\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u524d\u63d0\u6761\u4ef6<\/h2>\n<p>\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306b\u5f93\u3046\u305f\u3081\u306b\u306f\u3001\u6b21\u306e\u3082\u306e\u304c\u5fc5\u8981\u3067\u3059\uff1a<\/p>\n<ul class=\"post-ul\">\n<li>A local machine or development server running Ubuntu 22.04. Your development machine should have a non-root user with administrative privileges and a firewall configured with ufw. For instructions on how to set this up, read our Initial Server Setup with Ubuntu 22.04 tutorial.<\/li>\n<li>Node.js and npm installed on your local machine or development server. This tutorial uses Node.js version 18.13.0 and npm version 8.19.3. For guidance on installing Node.js and npm on Ubuntu 22.04, follow the instructions in the Option 2 \u2014Installing Using a PPA section of How To Install Node.js on Ubuntu 22.04.<\/li>\n<li>Ruby, rbenv, and Rails installed on your local machine or development server, following Steps 1-4 in How To Install Ruby on Rails with rbenv on Ubuntu 22.04. This tutorial uses Ruby 3.2.0, rbenv 1.2.0-52, and Rails 7.0.4.<\/li>\n<\/ul>\n<p>Node.js\u3001Ruby\u3001rbenv\u3001\u304a\u3088\u3073Rails\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u7528\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u6e96\u5099\u304c\u3067\u304d\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u30b9\u30c6\u30c3\u30d71 &#8211; SQLite3\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<p>Rails\u30b7\u30e3\u30fc\u30af\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3059\u308b\u524d\u306b\u3001\u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3059\u308b\u305f\u3081\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u5fc5\u8981\u3067\u3059\u3002Rails\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067SQLite\u3092\u4f7f\u7528\u3059\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3055\u308c\u3066\u304a\u308a\u3001\u3053\u308c\u306f\u958b\u767a\u306b\u304a\u3044\u3066\u3057\u3070\u3057\u3070\u826f\u3044\u9078\u629e\u80a2\u3067\u3059\u3002\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30c7\u30fc\u30bf\u304c\u30d7\u30ed\u30b0\u30e9\u30e0\u7684\u306a\u62e1\u5f35\u6027\u3092\u8981\u6c42\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u3001SQLite\u306f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30cb\u30fc\u30ba\u306b\u9069\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u6700\u521d\u306b\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u5185\u3067\u30d1\u30c3\u30b1\u30fc\u30b8\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u66f4\u65b0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> update<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u6b21\u306b\u3001sqlite3\u3068libsqlite3-dev\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> <span class=\"token function\">install<\/span> sqlite3 libsqlite3-dev<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3053\u308c\u306b\u3088\u308a\u3001SQLite\u304a\u3088\u3073\u5fc5\u8981\u306a\u958b\u767a\u30d5\u30a1\u30a4\u30eb\u304c\u4e21\u65b9\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u6210\u529f\u3057\u305f\u304b\u3069\u3046\u304b\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u3001\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">sqlite3 <span class=\"token parameter variable\">&#8211;version<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p><mark>3.37.2<\/mark> 2022-01-06 13:25:41 <mark>872ba256cbf61d9290b571c0e6d82a20c224ca3ad82971edc46b29818d5dalt1<\/mark><\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>SQLite\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u3089\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u958b\u767a\u3092\u59cb\u3081\u308b\u6e96\u5099\u304c\u6574\u3044\u307e\u3057\u305f\u3002<\/p>\n<h2>\u30b9\u30c6\u30c3\u30d72 &#8211; \u65b0\u3057\u3044Rails\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u6210<\/h2>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u3089\u3001rails new\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066\u65b0\u3057\u3044Rails\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3001Rails\u304c\u63d0\u4f9b\u3059\u308b\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30dc\u30a4\u30e9\u30fc\u30d7\u30ec\u30fc\u30c8\u30b3\u30fc\u30c9\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u300csharkapp\u300d\u3068\u3044\u3046\u540d\u524d\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306b\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">rails new <mark>sharkapp<\/mark><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u51fa\u529b\u306f\u3001\u65b0\u3057\u3044\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u305f\u3081\u306bRails\u304c\u4f5c\u6210\u3059\u308b\u3055\u307e\u3056\u307e\u306a\u8981\u7d20\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002\u6b21\u306e\u51fa\u529b\u3067\u306f\u3001\u3044\u304f\u3064\u304b\u306e\u91cd\u8981\u306a\u30d5\u30a1\u30a4\u30eb\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3001\u304a\u3088\u3073\u30b3\u30de\u30f3\u30c9\u304c\u5f37\u8abf\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>create . . . create Gemfile . . . create app . . . create app\/controllers\/application_controller.rb . . . create app\/models\/application_record.rb . . . create app\/views\/layouts\/application.html.erb . . . create config create config\/routes.rb create config\/application.rb . . . create config\/environments create config\/environments\/development.rb create config\/environments\/production.rb create config\/environments\/test.rb . . . create config\/database.yml create db create db\/seeds.rb . . . run bundle install . . . Bundle complete! 15 Gemfile dependencies, 69 gems now installed. Use `bundle info [gemname]` to see where a bundled gem is installed. . . .<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4ee5\u4e0b\u306f\u3001Rails\u306e\u30d5\u30a1\u30a4\u30eb\u3068\u30d5\u30a9\u30eb\u30c0\u306e\u3044\u304f\u3064\u304b\u3092\u7c21\u5358\u306b\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<ul class=\"post-ul\">\n<li>Gemfile: This file lists the gem dependencies for your application. A gem is a Ruby software package, and a Gemfile allows you to manage your project\u2019s software needs.<\/li>\n<li>app: The app directory is where your main application code lives. This includes the models, controllers, views, assets, helpers, and mailers that make up the application itself. Rails gives you some application-level boilerplate for the MVC model to start out in files like app\/models\/application_record.rb, app\/controllers\/application_controller.rb, and app\/views\/layouts\/application.html.erb.<\/li>\n<li>config: This directory contains your application\u2019s configuration settings:config\/routes.rb: Your application\u2019s route declarations live in this file.<br \/>\nconfig\/application.rb: General settings for your application components are located in this file.<\/li>\n<li>config\/environments: This directory is where configuration settings for your environments live. Rails includes three environments by default: development, production, and test.<\/li>\n<li>config\/database.yml: Database configuration settings live in this file, which is broken into four sections: default, development, production, and test. Thanks to the Gemfile that came with the rails new command, which included the sqlite3 gem, the config\/database.yml file has its adapter parameter set to sqlite3, specifying that you will use a SQLite database with this application.<\/li>\n<li>db: This folder includes a directory for database migrations called migrate, along with the schema.rb and seeds.rb files. schema.db contains information about your database, while seeds.rb is where you can place seed data for the database.<\/li>\n<\/ul>\n<p>\u6700\u7d42\u7684\u306b\u3001Rails\u306fGemfile\u306b\u30ea\u30b9\u30c8\u3055\u308c\u3066\u3044\u308b\u4f9d\u5b58\u95a2\u4fc2\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u305f\u3081\u306bbundle install\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<p>\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u304c\u5b8c\u4e86\u3057\u305f\u3089\u3001\u65b0\u3057\u3044sharkapp\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token builtin class-name\">cd<\/span> <mark>sharkapp<\/mark><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u300csharkapp\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u3067\u3001rails server\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u6b63\u5e38\u306b\u52d5\u4f5c\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u3001Rails\u30b5\u30fc\u30d0\u30fc\u3092\u8d77\u52d5\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u30ed\u30fc\u30ab\u30eb\u30de\u30b7\u30f3\u3067\u4f5c\u696d\u3057\u3066\u3044\u308b\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u5165\u529b\u3057\u3066\u30b5\u30fc\u30d0\u30fc\u3092\u8d77\u52d5\u3057\u307e\u3059\u3002\u300d<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">rails server<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>Rails\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067localhost\u306b\u30d0\u30a4\u30f3\u30c9\u3055\u308c\u3066\u304a\u308a\u3001\u30d6\u30e9\u30a6\u30b6\u3067locahost:3000\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656445b9daa94e2bdf7ad0b9\/33-0.PNG\" alt=\"Rails default landing page.\" \/><\/div>\n<p>\u958b\u767a\u30b5\u30fc\u30d0\u30fc\u3067\u4f5c\u696d\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u307e\u305a\u30dd\u30fc\u30c83000\u3067\u306e\u63a5\u7d9a\u304c\u8a31\u53ef\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> ufw allow <span class=\"token number\">3000<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u305d\u306e\u5f8c\u3001&#8211;binding\u30d5\u30e9\u30b0\u3092\u4f7f\u7528\u3057\u3066\u30b5\u30fc\u30d0\u30fc\u3092\u958b\u59cb\u3057\u3001\u30b5\u30fc\u30d0\u30fc\u306eIP\u30a2\u30c9\u30ec\u30b9\u306b\u30d0\u30a4\u30f3\u30c9\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">rails server <span class=\"token parameter variable\">&#8211;binding<\/span><span class=\"token operator\">=<\/span><mark>your_server_ip<\/mark><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u30d6\u30e9\u30a6\u30b6\u3067http:\/\/your_server_ip:3000\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306eRails\u30e9\u30f3\u30c7\u30a3\u30f3\u30b0\u30da\u30fc\u30b8\u306b\u79fb\u52d5\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u6e96\u5099\u304c\u3067\u304d\u305f\u3089\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u3067CTRL+C\u3092\u62bc\u3059\u3053\u3068\u3067\u30b5\u30fc\u30d0\u30fc\u3092\u505c\u6b62\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>Rails\u306e\u96db\u5f62\u304c\u3067\u304d\u305f\u3089\u3001\u30e6\u30cb\u30fc\u30af\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306b\u3001\u30d3\u30eb\u30c9\u3092\u958b\u59cb\u3059\u308b\u6e96\u5099\u304c\u6574\u3044\u307e\u3057\u305f\u3002<\/p>\n<h2>\u30b9\u30c6\u30c3\u30d73 &#8211; \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u8db3\u5834\u4f5c\u308a<\/h2>\n<p>\u9bab\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30c7\u30fc\u30bf\u306e\u7ba1\u7406\u306e\u305f\u3081\u306e\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3057\u3001\u305d\u306e\u30c7\u30fc\u30bf\u3068\u30e6\u30fc\u30b6\u30fc\u306e\u5bfe\u8a71\u3092\u53ef\u80fd\u306b\u3059\u308b\u30d3\u30e5\u30fc\u3092\u4f5c\u6210\u3057\u3001\u30e2\u30c7\u30eb\u3068\u30d3\u30e5\u30fc\u306e\u9593\u306e\u901a\u4fe1\u3092\u7ba1\u7406\u3059\u308b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3092\u4f5c\u6210\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u3089\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306b\u306f\u3001Rails\u306egenerate scaffold\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30e2\u30c7\u30eb\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b9\u30ad\u30fc\u30de\u3092\u5909\u66f4\u3059\u308b\u305f\u3081\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306eCreate\u3001Read\u3001Update\u3001Delete\uff08CRUD\uff09\u64cd\u4f5c\u3092\u7ba1\u7406\u3059\u308b\u305f\u3081\u306e\u30d3\u30e5\u30fc\u306e\u5b8c\u5168\u306a\u30bb\u30c3\u30c8\u3001\u30d1\u30fc\u30b7\u30e3\u30eb\u3001\u30d8\u30eb\u30d1\u30fc\u3001\u304a\u3088\u3073\u30c6\u30b9\u30c8\u7528\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304c\u751f\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u30b8\u30a7\u30cd\u30ec\u30fc\u30c8\u30b9\u30ad\u30e3\u30d5\u30a9\u30fc\u30eb\u30c9\u30b3\u30de\u30f3\u30c9\u306f\u3001\u88cf\u3067\u591a\u304f\u306e\u3053\u3068\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\u3053\u306e\u30b3\u30de\u30f3\u30c9\u306b\u306f\u3001\u30e2\u30c7\u30eb\u306e\u540d\u524d\u3068\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u306b\u542b\u3081\u305f\u3044\u30d5\u30a3\u30fc\u30eb\u30c9\u304c\u542b\u307e\u308c\u307e\u3059\u3002Rails\u306fActive Record\u3092\u4f7f\u7528\u3057\u3066\u3001\u30e2\u30c7\u30eb\u3068\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30c7\u30fc\u30bf\u306e\u95a2\u4fc2\u3092\u7ba1\u7406\u3057\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u30e2\u30c7\u30eb\u306fRuby\u306e\u30af\u30e9\u30b9\u3067\u3042\u308a\u3001\u540c\u6642\u306bActiveRecord::Base\u30af\u30e9\u30b9\u3092\u7d99\u627f\u3057\u3066\u3044\u307e\u3059\u3002\u3064\u307e\u308a\u3001Ruby\u306e\u30af\u30e9\u30b9\u3068\u540c\u69d8\u306b\u30e2\u30c7\u30eb\u30af\u30e9\u30b9\u3092\u6271\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3055\u3089\u306b\u3001Active Record\u304b\u3089\u30e1\u30bd\u30c3\u30c9\u3092\u5f15\u304d\u51fa\u3059\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002Active Record\u306f\u3001\u5404\u30af\u30e9\u30b9\u304c\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u30de\u30c3\u30d4\u30f3\u30b0\u3055\u308c\u3001\u305d\u306e\u30af\u30e9\u30b9\u306e\u5404\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u305d\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u884c\u306b\u30de\u30c3\u30d4\u30f3\u30b0\u3055\u308c\u308b\u3053\u3068\u3092\u4fdd\u8a3c\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u3001Shark\u30e2\u30c7\u30eb\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3001\u95a2\u9023\u3059\u308b\u30d3\u30e5\u30fc\u3092\u751f\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">rails generate scaffold Shark name:string facts:text<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3053\u306e\u30b3\u30de\u30f3\u30c9\u306e\u4e2d\u306e\u300c\u540d\u524d\uff1a\u6587\u5b57\u5217\u300d\u3068\u300c\u4e8b\u5b9f\uff1a\u30c6\u30ad\u30b9\u30c8\u300d\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30c6\u30fc\u30d6\u30eb\u3067\u4f5c\u6210\u3057\u3066\u3044\u308b\u30d5\u30a3\u30fc\u30eb\u30c9\u3068\u3001\u305d\u308c\u3089\u304c\u53d7\u3051\u5165\u308c\u308b\u30c7\u30fc\u30bf\u306e\u7a2e\u985e\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002\u3069\u3061\u3089\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3082\u5165\u529b\u3059\u308b\u5185\u5bb9\u3092\u81ea\u7531\u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u300c\u30c6\u30ad\u30b9\u30c8\u300d\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u65b9\u304c\u6587\u5b57\u6570\u304c\u591a\u304f\u5165\u529b\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3059\u308b\u3068\u3001\u51fa\u529b\u306b\u306f\u751f\u6210\u3055\u308c\u308b\u3055\u307e\u3056\u307e\u306a\u30d5\u30a1\u30a4\u30eb\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>invoke active_record create db\/migrate\/<mark>20190804181822<\/mark>_create_sharks.rb create app\/models\/shark.rb . . . invoke resource_route route resources :sharks invoke scaffold_controller create app\/controllers\/sharks_controller.rb invoke erb create app\/views\/sharks create app\/views\/sharks\/index.html.erb create app\/views\/sharks\/edit.html.erb create app\/views\/sharks\/show.html.erb create app\/views\/sharks\/new.html.erb create app\/views\/sharks\/_form.html.erb . . .<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>Rails\u306f\u3001app\/models\/shark.rb\u306b\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3057\u3001\u305d\u308c\u306b\u5bfe\u5fdc\u3059\u308b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3082\u4f5c\u6210\u3057\u307e\u3057\u305f\uff1adb\/migrate\/20190804181822_create_sharks.rb\u3002\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u30d5\u30a1\u30a4\u30eb\u306e\u30bf\u30a4\u30e0\u30b9\u30bf\u30f3\u30d7\u306f\u3001\u4f8b\u3068\u306f\u7570\u306a\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306eCRUD\u64cd\u4f5c\u306b\u95a2\u9023\u3059\u308b\u30d3\u30e5\u30fc\u3092app\/views\/sharks\u306e\u4e0b\u306b\u4f5c\u6210\u3057\u3001controller\u3067\u3042\u308bapp\/controllers\/sharks_controller.rb\u3082\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002\u3053\u308c\u3089\u306e\u30d3\u30e5\u30fc\u306e\u4e2d\u306b\u306f\u3001\u8907\u6570\u306e\u30d3\u30e5\u30fc\u3067\u4f7f\u7528\u3055\u308c\u308b\u30b3\u30fc\u30c9\u304c\u542b\u307e\u308c\u308b\u90e8\u5206\u30d3\u30e5\u30fc\u3067\u3042\u308b_form.html.erb\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u6700\u7d42\u7684\u306b\u3001Rails\u306fconfig\/routes.rb\u306b\u65b0\u3057\u3044\u30ea\u30bd\u30fc\u30b9\u30eb\u30fc\u30c8\u3067\u3042\u308bresources :sharks\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\u3002\u3053\u308c\u306b\u3088\u308a\u3001Rails\u306e\u30eb\u30fc\u30bf\u30fc\u306f\u53d7\u4fe1\u3057\u305fHTTP\u30ea\u30af\u30a8\u30b9\u30c8\u3092sharks\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3068\u305d\u306e\u95a2\u9023\u30d3\u30e5\u30fc\u306b\u30de\u30c3\u30c1\u3055\u305b\u308b\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>Rails\u306f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b3\u30fc\u30c9\u306e\u5927\u90e8\u5206\u3092\u69cb\u7bc9\u3057\u3066\u304f\u308c\u307e\u3057\u305f\u304c\u3001\u4f55\u304c\u8d77\u3053\u3063\u3066\u3044\u308b\u306e\u304b\u3092\u3088\u308a\u7406\u89e3\u3059\u308b\u305f\u3081\u306b\u3044\u304f\u3064\u304b\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u6df1\u304f\u5165\u308a\u8fbc\u3080\u4fa1\u5024\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u30d5\u30a1\u30a4\u30eb\u3092\u7406\u89e3\u3059\u308b\u305f\u3081\u306b\u3001\u7aef\u672b\u306b\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">cat<\/span> app\/controllers\/sharks_controller.rb<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>class SharksController &lt; ApplicationController before_action :set_shark, only: %i[ show edit update destroy ] # GET \/sharks or \/sharks.json def index @sharks = Shark.all end # GET \/sharks\/1 or \/sharks\/1.json def show end # GET \/sharks\/new def new @shark = Shark.new end # GET \/sharks\/1\/edit def edit end # POST \/sharks or \/sharks.json def create @shark = Shark.new(shark_params) respond_to do |format| if @shark.save format.html { redirect_to shark_url(@shark), notice: &#8220;Shark was successfully created.&#8221; } format.json { render :show, status: :created, location: @shark } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @shark.errors, status: :unprocessable_entity } end end end # PATCH\/PUT \/sharks\/1 or \/sharks\/1.json def update respond_to do |format| if @shark.update(shark_params) format.html { redirect_to shark_url(@shark), notice: &#8220;Shark was successfully updated.&#8221; } format.json { render :show, status: :ok, location: @shark } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @shark.errors, status: :unprocessable_entity } end end end # DELETE \/sharks\/1 or \/sharks\/1.json def destroy @shark.destroy respond_to do |format| format.html { redirect_to sharks_url, notice: &#8220;Shark was successfully destroyed.&#8221; } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_shark @shark = Shark.find(params[:id]) end # Only allow a list of trusted parameters through. def shark_params params.require(:shark).permit(:name, :facts) end end<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306f\u3001\u60c5\u5831\u306e\u53d6\u5f97\u304a\u3088\u3073\u95a2\u9023\u3059\u308b\u30e2\u30c7\u30eb\u3078\u306e\u6e21\u3057\u65b9\u3001\u304a\u3088\u3073\u305d\u308c\u304c\u7279\u5b9a\u306e\u30d3\u30e5\u30fc\u3068\u95a2\u9023\u4ed8\u3051\u3089\u308c\u308b\u65b9\u6cd5\u306e\u7ba1\u7406\u3092\u62c5\u5f53\u3057\u3066\u3044\u307e\u3059\u3002\u305f\u3068\u3048\u3070\u3001\u30b7\u30e3\u30fc\u30af\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u306f\u3001\u6a19\u6e96\u7684\u306aCRUD\u64cd\u4f5c\u306b\u304a\u304a\u3088\u305d\u5bfe\u5fdc\u3059\u308b\u4e00\u9023\u306e\u30e1\u30bd\u30c3\u30c9\u304c\u3042\u308a\u307e\u3059\u3002\u30a8\u30e9\u30fc\u306e\u5834\u5408\u306e\u52b9\u7387\u5316\u3092\u53ef\u80fd\u306b\u3059\u308b\u305f\u3081\u3001CRUD\u306e\u6a5f\u80fd\u4ee5\u4e0a\u306e\u30e1\u30bd\u30c3\u30c9\u304c\u5b58\u5728\u3057\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001create\u30e1\u30bd\u30c3\u30c9\u3092\u8003\u3048\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<div>\n<p>~\/sharkapp\/app\/controllers\/sharks_controller.rb\u3092\u65e5\u672c\u8a9e\u3067\u8a00\u3044\u63db\u3048\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\uff1a<\/p>\n<p>~\/sharkapp\/app\/controllers\/sharks_controller.rb<\/p>\n<\/div>\n<pre class=\"post-pre\"><code>. . .\r\n  def create\r\n    @shark = Shark.new(shark_params)\r\n\r\n    respond_to do |format|\r\n      if @shark.save\r\n        format.html { redirect_to @shark, notice: 'Shark was successfully created.' }\r\n        format.json { render :show, status: :created, location: @shark }\r\n      else\r\n        format.html { render :new }\r\n        format.json { render json: @shark.errors, status: :unprocessable_entity }\r\n      end\r\n    end\r\n  end\r\n. . . \r\n<\/code><\/pre>\n<p>\u65b0\u3057\u3044Shark\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u6b63\u5e38\u306b\u4fdd\u5b58\u3055\u308c\u305f\u5834\u5408\u3001redirect_to\u306f\u65b0\u3057\u3044\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u751f\u6210\u3057\u3001\u305d\u308c\u304c\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306b\u5411\u3051\u3089\u308c\u307e\u3059\u3002\u3053\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306fGET\u30ea\u30af\u30a8\u30b9\u30c8\u3067\u3042\u308a\u3001show\u30e1\u30bd\u30c3\u30c9\u3067\u51e6\u7406\u3055\u308c\u307e\u3059\u3002show\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u6700\u8fd1\u8ffd\u52a0\u3055\u308c\u305f\u5165\u529b\u60c5\u5831\u3092\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<p>\u3082\u3057\u5931\u6557\u304c\u3042\u308c\u3070\u3001Rails\u306f\u30eb\u30fc\u30bf\u30fc\u306b\u5225\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u308b\u4ee3\u308f\u308a\u306b\u3001\u540c\u3058\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306eapp\/views\/sharks\/new.html.erb\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u518d\u5ea6\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3057\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u30c7\u30fc\u30bf\u3092\u518d\u63d0\u51fa\u3059\u308b\u6a5f\u4f1a\u3092\u4e0e\u3048\u307e\u3059\u3002<\/p>\n<p>\u30b7\u30e3\u30fc\u30af\u30ba\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u52a0\u3048\u3066\u3001Rails\u306f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30d3\u30e5\u30fc\u306e\u305f\u3081\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3082\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002\u3053\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306f\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u5185\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30e1\u30bd\u30c3\u30c9\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u3092\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30eb\u30fc\u30c8\u30d3\u30e5\u30fc\u3068\u3057\u3066\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u30d5\u30a1\u30a4\u30eb\u3092\u51fa\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">cat<\/span> app\/views\/sharks\/index.html.erb<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&lt;p style=&#8221;color: green&#8221;&gt;&lt;%= notice %&gt;&lt;\/p&gt; &lt;h1&gt;Sharks&lt;\/h1&gt; &lt;div id=&#8221;sharks&#8221;&gt; &lt;% @sharks.each do |shark| %&gt; &lt;%= render shark %&gt; &lt;p&gt; &lt;%= link_to &#8220;Show this shark&#8221;, shark %&gt; &lt;\/p&gt; &lt;% end %&gt; &lt;\/div&gt; &lt;%= link_to &#8220;New shark&#8221;, new_shark_path %&gt;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30d3\u30e5\u30fc\u306f\u3001Shark\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u30eb\u30fc\u30d7\u51e6\u7406\u3057\u307e\u3059\u3002\u3053\u306e\u30af\u30e9\u30b9\u306f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306esharks\u30c6\u30fc\u30d6\u30eb\u3068\u30de\u30c3\u30d4\u30f3\u30b0\u3055\u308c\u3066\u3044\u307e\u3059\u3002ERB\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u4f7f\u7528\u3057\u3066\u3001\u30d3\u30e5\u30fc\u306f\u5404\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u51fa\u529b\u3057\u307e\u3059\u3002\u500b\u3005\u306e\u30b5\u30e1\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\u30d5\u30a3\u30fc\u30eb\u30c9\u306f\u3001\u540d\u524d\u3068\u4e8b\u5b9f\u3067\u3059\u3002<\/p>\n<p>\u305d\u306e\u5f8c\u306e\u30d3\u30e5\u30fc\u306f\u3001link_to \u30d8\u30eb\u30d1\u30fc\u3092\u4f7f\u7528\u3057\u3066\u3001\u30ea\u30f3\u30af\u306e\u30c6\u30ad\u30b9\u30c8\u3068\u3057\u3066\u63d0\u4f9b\u3055\u308c\u305f\u6587\u5b57\u5217\u3001\u5b9b\u5148\u3068\u3057\u3066\u63d0\u4f9b\u3055\u308c\u305f\u30d1\u30b9\u3092\u6301\u3064\u30cf\u30a4\u30d1\u30fc\u30ea\u30f3\u30af\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u30d1\u30b9\u81ea\u4f53\u306f\u3001rails generate scaffold \u30b3\u30de\u30f3\u30c9\u3067\u5b9a\u7fa9\u3057\u305f sharks \u30ea\u30bd\u30fc\u30b9\u306e\u30eb\u30fc\u30c8\u306b\u3088\u3063\u3066\u53ef\u80fd\u306b\u3055\u308c\u305f\u30d8\u30eb\u30d1\u30fc\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u65b0\u3057\u3044\u30d3\u30e5\u30fc\u306f\u3001\u30d1\u30fc\u30b7\u30e3\u30eb\u3068\u547c\u3070\u308c\u308b\u3082\u306e\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u3066\u3001app\/views\/sharks\/new.html.erb \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">cat<\/span> app\/views\/sharks\/new.html.erb<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&lt;h1&gt;New shark&lt;\/h1&gt; &lt;%= render &#8220;form&#8221;, shark: @shark %&gt; &lt;br&gt; &lt;div&gt; &lt;%= link_to &#8220;Back to sharks&#8221;, sharks_path %&gt; &lt;\/div&gt;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u65b0\u3057\u3044\u30b5\u30e1\u306e\u60c5\u5831\u304c\u5165\u529b\u6b04\u3092\u6301\u305f\u306a\u3044\u3088\u3046\u306b\u898b\u3048\u308b\u3053\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u3059\u304c\u3001&#8217;form&#8217; \u3092\u53c2\u7167\u3057\u3066\u3044\u308b\u3053\u3068\u304b\u3089\u3001\u3053\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306f _form.html.erb \u306e\u90e8\u5206\u3092\u5f15\u3063\u5f35\u3063\u3066\u304d\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306f\u30d3\u30e5\u30fc\u9593\u3067\u7e70\u308a\u8fd4\u3057\u4f7f\u7528\u3055\u308c\u308b\u30b3\u30fc\u30c9\u3092\u62bd\u51fa\u3057\u307e\u3059\u3002<\/p>\n<p>\u65b0\u3057\u3044\u30b5\u30e1\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u4f5c\u6210\u3055\u308c\u308b\u65b9\u6cd5\u3092\u3088\u308a\u8a73\u3057\u304f\u77e5\u308a\u305f\u3044\u5834\u5408\u306f\u3001_form.html.erb\u30d5\u30a1\u30a4\u30eb\u3092\u51fa\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">cat<\/span> app\/views\/sharks\/_form.html.erb<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&lt;%= form_with(model: shark) do |form| %&gt; &lt;% if shark.errors.any? %&gt; &lt;div style=&#8221;color: red&#8221;&gt; &lt;h2&gt;&lt;%= pluralize(shark.errors.count, &#8220;error&#8221;) %&gt; prohibited this shark from being saved:&lt;\/h2&gt; &lt;ul&gt; &lt;% shark.errors.each do |error| %&gt; &lt;li&gt;&lt;%= error.full_message %&gt;&lt;\/li&gt; &lt;% end %&gt; &lt;\/ul&gt; &lt;\/div&gt; &lt;% end %&gt; &lt;div&gt; &lt;%= form.label :name, style: &#8220;display: block&#8221; %&gt; &lt;%= form.text_field :name %&gt; &lt;\/div&gt; &lt;div&gt; &lt;%= form.label :facts, style: &#8220;display: block&#8221; %&gt; &lt;%= form.text_area :facts %&gt; &lt;\/div&gt; &lt;div&gt; &lt;%= form.submit %&gt; &lt;\/div&gt; &lt;% end %&gt;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3053\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306f\u3001form_with\u30d5\u30a9\u30fc\u30e0\u30d8\u30eb\u30d1\u30fc\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002\u30d5\u30a9\u30fc\u30e0\u30d8\u30eb\u30d1\u30fc\u306f\u3001\u7279\u5b9a\u306e\u30e2\u30c7\u30eb\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u3068\u30b9\u30b3\u30fc\u30d7\u3092\u4f7f\u7528\u3057\u3066\u3001\u30e6\u30fc\u30b6\u30fc\u306e\u5165\u529b\u304b\u3089\u65b0\u3057\u3044\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u6210\u3092\u5bb9\u6613\u306b\u3059\u308b\u305f\u3081\u306b\u8a2d\u8a08\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u4f8b\u3067\u306f\u3001form_with\u306f\u5f15\u6570\u3068\u3057\u3066model: shark\u3092\u53d6\u308a\u3001\u305d\u308c\u304c\u751f\u6210\u3059\u308b\u65b0\u3057\u3044\u30d5\u30a9\u30fc\u30e0\u30d3\u30eb\u30c0\u30fc\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u306f\u3001sharks\u30c6\u30fc\u30d6\u30eb\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u5bfe\u5fdc\u3059\u308b\u30d5\u30a3\u30fc\u30eb\u30c9\u5165\u529b\u304c\u3042\u308a\u307e\u3059\u3002\u3064\u307e\u308a\u3001\u30e6\u30fc\u30b6\u30fc\u306f\u30b7\u30e3\u30fc\u30af\u306e\u540d\u524d\u3068\u30b7\u30e3\u30fc\u30af\u306e\u60c5\u5831\u3092\u5165\u529b\u3059\u308b\u305f\u3081\u306e\u30d5\u30a9\u30fc\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u6301\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u30d5\u30a9\u30fc\u30e0\u3092\u9001\u4fe1\u3059\u308b\u3068\u3001JSON\u30ec\u30b9\u30dd\u30f3\u30b9\u304c\u4f5c\u6210\u3055\u308c\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u6b8b\u308a\u306e\u90e8\u5206\u306fparams\u30e1\u30bd\u30c3\u30c9\u3092\u901a\u3058\u3066\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u304c\u542b\u307e\u308c\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u305d\u306e\u30c7\u30fc\u30bf\u3067ActionController::Parameters\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>rails generate scaffold\u3067\u751f\u6210\u3055\u308c\u305f\u3082\u306e\u3092\u77e5\u3063\u305f\u4eca\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30eb\u30fc\u30c8\u30d3\u30e5\u30fc\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u306b\u9032\u3080\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u30b9\u30c6\u30c3\u30d74-\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30eb\u30fc\u30c8\u30d3\u30e5\u30fc\u306e\u4f5c\u6210\u3068\u6a5f\u80fd\u306e\u30c6\u30b9\u30c8<\/h2>\n<p>\u7406\u60f3\u7684\u306b\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30e9\u30f3\u30c7\u30a3\u30f3\u30b0\u30da\u30fc\u30b8\u3092\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30eb\u30fc\u30c8\u306b\u30de\u30c3\u30d4\u30f3\u30b0\u3059\u308b\u3053\u3068\u304c\u671b\u307e\u3057\u3044\u3067\u3059\u3002\u305d\u3046\u3059\u308b\u3053\u3068\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u306f\u3059\u3050\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u76ee\u7684\u3092\u611f\u3058\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305f\u3068\u3048\u3070\u3001\u30a6\u30a7\u30eb\u30ab\u30e0\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3068\u95a2\u9023\u3059\u308b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30d3\u30e5\u30fc\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u6c4e\u7528\u306e\u30e9\u30f3\u30c7\u30a3\u30f3\u30b0\u30da\u30fc\u30b8\u304c\u63d0\u4f9b\u3055\u308c\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u3055\u307e\u3056\u307e\u306a\u90e8\u5206\u3078\u306e\u30ea\u30f3\u30af\u3082\u53ef\u80fd\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u306b\u306f\u3001config\/routes.rb \u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u8a2d\u5b9a\u3092\u5909\u66f4\u3057\u3066\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30eb\u30fc\u30c8\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>nano\u307e\u305f\u306f\u304a\u6c17\u306b\u5165\u308a\u306e\u30a8\u30c7\u30a3\u30bf\u3092\u4f7f\u7528\u3057\u3066\u3001\u7de8\u96c6\u306e\u305f\u3081\u306bconfig\/routes.rb\u3092\u958b\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">nano<\/span> config\/routes.rb<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div>\u4ee5\u4e0b\u306e\u6587\u3092\u65e5\u672c\u8a9e\u3067\u81ea\u7136\u306a\u8a00\u3044\u65b9\u3067\u8868\u73fe\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u4e00\u3064\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u69cb\u3044\u307e\u305b\u3093\u3002<br \/>\n\u300c~\/sharkapp\/config\/routes.rb\u300d<\/div>\n<pre class=\"post-pre\"><code>Rails.application.routes.draw do\r\n  resources :sharks\r\n  # Define your application routes per the DSL in https:\/\/guides.rubyonrails.org\/routing.html\r\n\r\n  # Defines the root path route (\"\/\")\r\n  # root \"articles#index\"\r\nend\r\n<\/code><\/pre>\n<p>\u3088\u308a\u5177\u4f53\u7684\u306a\u8a2d\u5b9a\u3092\u3057\u306a\u3044\u5834\u5408\u3001http:\/\/localhost:3000\u307e\u305f\u306fhttp:\/\/your_server_ip:3000\u3067\u8868\u793a\u3055\u308c\u308b\u753b\u9762\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306eRails\u306e\u30a6\u30a7\u30eb\u30ab\u30e0\u30da\u30fc\u30b8\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30eb\u30fc\u30c8\u30d3\u30e5\u30fc\u3092\u30b7\u30e3\u30fc\u30af\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30d3\u30e5\u30fc\u306b\u30de\u30c3\u30d4\u30f3\u30b0\u3059\u308b\u306b\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e#root &#8220;articles#index&#8221;\u306e\u884c\u306e\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3092\u89e3\u9664\u3057\u3001#\u3092\u524a\u9664\u3057\u3066article\u3092shark\u306b\u7f6e\u304d\u63db\u3048\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>~\/sharkapp\/config\/routes.rb\u3092\u65e5\u672c\u8a9e\u3067\u8a00\u3044\u63db\u3048\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\uff1a<br \/>\n~\/sharkapp\/config\/routes.rb<\/div>\n<pre class=\"post-pre\"><code>Rails.application.routes.draw do\r\n  resources :sharks\r\n\r\n  <mark>root 'sharks#index'<\/mark> \r\n  # For details on the DSL available within this file, see http:\/\/guides.rubyonrails.org\/routing.html\r\nend\r\n<\/code><\/pre>\n<p>\u7de8\u96c6\u304c\u7d42\u308f\u3063\u305f\u3089\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3057\u3001\u30a8\u30c7\u30a3\u30bf\u30fc\u3092\u7d42\u4e86\u3057\u3066\u304f\u3060\u3055\u3044\u3002nano\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u5834\u5408\u3001CTRL+X\u3001Y\u3092\u62bc\u3057\u3001\u6b21\u306bENTER\u30ad\u30fc\u3092\u62bc\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u4eca\u3067\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30eb\u30fc\u30c8\u306b\u79fb\u52d5\u3059\u308b\u3068\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306eRails\u306e\u30e9\u30f3\u30c7\u30a3\u30f3\u30b0\u30da\u30fc\u30b8\u3067\u306f\u306a\u304f\u3001\u30b5\u30e1\u306e\u30e9\u30f3\u30c7\u30a3\u30f3\u30b0\u30da\u30fc\u30b8\u306b\u5165\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002\u3055\u3089\u306b\u3001\u5f7c\u3089\u306f\u65b0\u3057\u3044\u30b5\u30e1\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u4f5c\u6210\u3057\u305f\u308a\u3001\u65e2\u5b58\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u78ba\u8a8d\u3057\u305f\u308a\u3001\u4e0e\u3048\u3089\u308c\u305f\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u7de8\u96c6\u307e\u305f\u306f\u524a\u9664\u3059\u308b\u6a5f\u4f1a\u3092\u6301\u3064\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u6b21\u306b\u3001\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">rails db:migrate<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3053\u306e\u51fa\u529b\u306f\u79fb\u884c\u304c\u78ba\u8a8d\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>== 20230124215633 CreateSharks: migrating ===================================== &#8212; create_table(:sharks) -&gt; 0.0041s == 20230124215633 CreateSharks: migrated (0.0045s) ============================<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3082\u3046\u4e00\u5ea6Rails\u30b5\u30fc\u30d0\u30fc\u3092\u8d77\u52d5\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u30ed\u30fc\u30ab\u30eb\u3067\u4f5c\u696d\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">rails s<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u958b\u767a\u30b5\u30fc\u30d0\u30fc\u3067\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">rails s <span class=\"token parameter variable\">&#8211;binding<\/span><span class=\"token operator\">=<\/span><mark>your_server_ip<\/mark><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u30ed\u30fc\u30ab\u30eb\u3067\u4f5c\u696d\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u3001localhost:3000\u306b\u79fb\u52d5\u3057\u3066\u3001\u958b\u767a\u30b5\u30fc\u30d0\u30fc\u3067\u4f5c\u696d\u3057\u3066\u3044\u308b\u5834\u5408\u306fhttp:\/\/your_server_ip:3000\u306b\u79fb\u52d5\u3057\u3066\u3001\u65b0\u3057\u3044\u30e9\u30f3\u30c7\u30a3\u30f3\u30b0\u30da\u30fc\u30b8\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656445b9daa94e2bdf7ad0b9\/101-0.png\" alt=\"Application Landing Page\" \/><\/div>\n<p>\u65b0\u3057\u3044\u30b5\u30e1\u3092\u4f5c\u6210\u3059\u308b\u306b\u306f\u3001\u300c\u65b0\u3057\u3044\u30b5\u30e1\u300d\u30ea\u30f3\u30af\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u306e\u30ea\u30f3\u30af\u306f\u300csharks\/new\u300d\u30eb\u30fc\u30c8\u306b\u7e4b\u304c\u308a\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656445b9daa94e2bdf7ad0b9\/103-0.png\" alt=\"Create New Shark\" \/><\/div>\n<p>\u3042\u306a\u305f\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306b\u3001\u3044\u304f\u3064\u304b\u306e\u60c5\u5831\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u300c\u540d\u524d\u300d\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u300cGreat White\u300d\u3068\u66f8\u304d\u3001\u300c\u4e8b\u5b9f\u300d\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u300cScary\u300d\u3068\u66f8\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656445b9daa94e2bdf7ad0b9\/105-0.png\" alt=\"Add Great White Shark\" \/><\/div>\n<p>\u305d\u306e\u5f8c\u3001\u30b7\u30e3\u30fc\u30af\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306b\u300c\u30b7\u30e3\u30fc\u30af\u4f5c\u6210\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3053\u306e\u30dc\u30bf\u30f3\u306f\u3001show\u30eb\u30fc\u30c8\u306b\u30ea\u30f3\u30af\u3057\u307e\u3059\u3002\u3053\u306e\u30eb\u30fc\u30c8\u306f\u3001before_action\u30d5\u30a3\u30eb\u30bf\u30fc\u306b\u3088\u3063\u3066\u3001set_shark\u30e1\u30bd\u30c3\u30c9\u3092\u4ecb\u3057\u3066\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002set_shark\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u4f5c\u6210\u3057\u305f\u30b5\u30e1\u306eID\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<div>~\/sharkapp\/app\/controllers\/sharks_controller.rb\u3092\u65e5\u672c\u8a9e\u3067\u30d1\u30e9\u30d5\u30ec\u30fc\u30ba\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u4e00\u3064\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3060\u3051\u5fc5\u8981\u3067\u3059\u3002<\/div>\n<pre class=\"post-pre\"><code>class SharksController &lt; ApplicationController\r\n  before_action <mark>:set_shark<\/mark>, only: %i[ <mark>show<\/mark> edit update destroy ]\r\n\r\n  . . . \r\n  # GET \/sharks\/1 or \/sharks\/1.json\r\n  def show\r\n  end\r\n\r\n  . . . \r\n\r\n  private\r\n    # Use callbacks to share common setup or constraints between actions.\r\n    def set_shark\r\n      @shark = Shark.find(params[<mark>:id<\/mark>])\r\n    end\r\n  . . .\r\n<\/code><\/pre>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656445b9daa94e2bdf7ad0b9\/110-0.png\" alt=\"Show Shark\" \/><\/div>\n<p>\u300c\u30b7\u30e3\u30fc\u30af\u30a8\u30f3\u30c8\u30ea\u30fc\u300d\u306e\u7de8\u96c6\u6a5f\u80fd\u3092\u8a66\u3059\u306b\u306f\u3001\u300c\u3053\u306e\u30b7\u30e3\u30fc\u30af\u3092\u7de8\u96c6\u3059\u308b\u300d\u3092\u62bc\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u305d\u306e\u30b7\u30e3\u30fc\u30af\u306e\u7de8\u96c6\u753b\u9762\u306b\u79fb\u52d5\u3057\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656445b9daa94e2bdf7ad0b9\/112-0.png\" alt=\"Edit Shark\" \/><\/div>\n<p>\u300c\u6050\u308d\u3057\u3044\u300d\u3068\u3044\u3046\u8868\u73fe\u3092\u300c\u5927\u304d\u3044\u300d\u3068\u3044\u3046\u4e8b\u5b9f\u306b\u66f4\u65b0\u3057\u3001\u300c\u30b5\u30e1\u3092\u66f4\u65b0\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30b7\u30e7\u30fc\u306e\u30eb\u30fc\u30c8\u306b\u623b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656445b9daa94e2bdf7ad0b9\/114-0.png\" alt=\"Updated Shark\" \/><\/div>\n<p>\u6700\u5f8c\u306b\u3001\u30d0\u30c3\u30af\u3092\u62bc\u3057\u3066\u30b5\u30e1\u306b\u623b\u308b\u3068\u3001\u66f4\u65b0\u3055\u308c\u305f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30d3\u30e5\u30fc\u306b\u79fb\u52d5\u3057\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656445b9daa94e2bdf7ad0b9\/116-0.png\" alt=\"New Index View\" \/><\/div>\n<p>\u3042\u306a\u305f\u304c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u57fa\u672c\u6a5f\u80fd\u3092\u30c6\u30b9\u30c8\u3057\u305f\u306e\u3067\u3001\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3084\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30c1\u30a7\u30c3\u30af\u3092\u8ffd\u52a0\u3057\u3066\u3001\u5168\u4f53\u3092\u3088\u308a\u5b89\u5168\u306b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>Step 5 \u2014 \u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u306e\u8ffd\u52a0<\/h2>\n<p>\u300c\u30e6\u30fc\u30b6\u30fc\u304b\u3089\u306e\u5165\u529b\u3092\u53d7\u3051\u4ed8\u3051\u308b\u3042\u306a\u305f\u306e\u30b7\u30e3\u30fc\u30af\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u3059\u304c\u3001\u4f8b\u3048\u3070\u30e6\u30fc\u30b6\u30fc\u304c\u4e8b\u5b9f\u3092\u8ffd\u52a0\u305b\u305a\u306b\u30b7\u30e3\u30fc\u30af\u3092\u4f5c\u308d\u3046\u3068\u3057\u305f\u308a\u3001\u65e2\u306b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u5b58\u5728\u3059\u308b\u30b7\u30e3\u30fc\u30af\u306e\u30a8\u30f3\u30c8\u30ea\u3092\u4f5c\u308d\u3046\u3068\u3057\u305f\u5834\u5408\u3092\u60f3\u50cf\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002\u30e2\u30c7\u30eb\u306b\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3067\u3001\u30c7\u30fc\u30bf\u304c\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u5165\u308b\u524d\u306b\u30c1\u30a7\u30c3\u30af\u3059\u308b\u30e1\u30ab\u30cb\u30ba\u30e0\u3092\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30ed\u30b8\u30c3\u30af\u306f\u30e2\u30c7\u30eb\u306b\u3042\u308b\u305f\u3081\u3001\u305d\u3053\u3067\u30c7\u30fc\u30bf\u5165\u529b\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3092\u884c\u3046\u306e\u304c\u9069\u5207\u3067\u3059\u3002\u300d<\/p>\n<p>\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30c6\u30b9\u30c8\u306e\u66f8\u304d\u65b9\u306b\u3064\u3044\u3066\u306f\u8aac\u660e\u3057\u3066\u3044\u307e\u305b\u3093\u304c\u3001Rails\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c6\u30fc\u30b7\u30e7\u30f3\u3092\u53c2\u7167\u3059\u308b\u3053\u3068\u3067\u3001\u30c6\u30b9\u30c8\u306b\u3064\u3044\u3066\u3082\u3063\u3068\u8a73\u3057\u304f\u77e5\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3082\u3057\u307e\u3060\u30b5\u30fc\u30d0\u30fc\u3092\u505c\u6b62\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u3067CTRL+C\u3092\u62bc\u3057\u3066\u30b5\u30fc\u30d0\u30fc\u3092\u505c\u6b62\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u300cshark.rb\u300d\u30e2\u30c7\u30eb\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">nano<\/span> app\/models\/shark.rb<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u73fe\u5728\u3001\u30d5\u30a1\u30a4\u30eb\u306f\u3001Shark\u30af\u30e9\u30b9\u304cApplicationRecord\u3092\u7d99\u627f\u3057\u3001\u3055\u3089\u306bActiveRecord::Base\u304b\u3089\u7d99\u627f\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<div>~\/sharkapp\/app\/models\/shark.rb\u3092\u65e5\u672c\u8a9e\u3067\u66f8\u304d\u63db\u3048\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\uff1a<br \/>\n\uff5e\/sharkapp\/app\/models\/shark.rb<\/div>\n<pre class=\"post-pre\"><code>class Shark &lt; ApplicationRecord\r\nend\r\n<\/code><\/pre>\n<p>\u540d\u524d\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u3044\u304f\u3064\u304b\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3057\u3066\u3001\u30d5\u30a3\u30fc\u30eb\u30c9\u304c\u5165\u529b\u3055\u308c\u3066\u304a\u308a\u3001\u30a8\u30f3\u30c8\u30ea\u304c\u91cd\u8907\u3057\u3066\u3044\u306a\u3044\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>~\/sharkapp\/app\/models\/shark.rb\u306e\u5185\u5bb9\u3092\u65e5\u672c\u8a9e\u3067\u8a00\u3044\u63db\u3048\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\uff1a<br \/>\n\u300c\u301c\/sharkapp\/app\/models\/shark.rb\u300d<\/div>\n<pre class=\"post-pre\"><code>class Shark &lt; ApplicationRecord\r\n  <mark>validates :name, presence: true, uniqueness: true<\/mark>\r\nend\r\n<\/code><\/pre>\n<p>\u6b21\u306b\u3001\u4e8b\u5b9f\u306e\u5165\u529b\u6b04\u3082\u8a18\u5165\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>~\/sharkapp\/app\/models\/shark.rb \u306e\u5185\u5bb9\u3092\u65e5\u672c\u8a9e\u3067\u66f8\u304d\u63db\u3048\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/div>\n<pre class=\"post-pre\"><code>class Shark &lt; ApplicationRecord\r\n  validates :name, presence: true, uniqueness: true\r\n  <mark>validates :facts, presence: true<\/mark>\r\nend\r\n<\/code><\/pre>\n<p>\u300cvalidates: facts, presence: true\u300d\u3068\u3044\u3046\u4e00\u884c\u306e\u30b3\u30fc\u30c9\u306f\u3001\u4e8b\u5b9f\u306e\u4e00\u610f\u6027\u306b\u306f\u95a2\u4e0e\u3057\u3066\u3044\u307e\u305b\u3093\u3002\u3053\u306e\u30b3\u30fc\u30c9\u306f\u3001\u30e6\u30cb\u30fc\u30af\u306a\u30b7\u30e3\u30fc\u30af\u306e\u30a8\u30f3\u30c8\u30ea\u3068\u306e\u95a2\u9023\u6027\u3092\u691c\u8a3c\u3057\u307e\u3059\u3002<\/p>\n<p>\u4f5c\u696d\u304c\u7d42\u308f\u3063\u305f\u3089\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3057\u9589\u3058\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u518d\u3073rails s\u307e\u305f\u306frails s &#8211;binding=your_server_ip\u3067\u30b5\u30fc\u30d0\u30fc\u3092\u8d77\u52d5\u3057\u3001\u6b21\u306bhttp:\/\/localhost:3000\u307e\u305f\u306fhttp:\/\/your_server_ip:3000\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30eb\u30fc\u30c8\u306b\u79fb\u52d5\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u300c\u65b0\u3057\u3044\u30b5\u30e1\u300d\u306e\u30ea\u30f3\u30af\u3092\u62bc\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u30d5\u30a9\u30fc\u30e0\u306b\u3001\u300cName\u300d\u6b04\u306b\u300c\u30b0\u30ec\u30fc\u30c8\u30db\u30ef\u30a4\u30c8\u300d\u3092\u8ffd\u52a0\u3057\u3001\u300cFacts\u300d\u6b04\u306b\u300c\u5927\u304d\u306a\u6b6f\u300d\u3092\u8ffd\u52a0\u3057\u3001\u305d\u308c\u304b\u3089\u300c\u30b5\u30e1\u3092\u4f5c\u6210\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u306e\u5834\u5408\u3001\u8b66\u544a\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656445b9daa94e2bdf7ad0b9\/137-0.png\" alt=\"Unique Validation Warning\" \/><\/div>\n<p>\u4ed6\u306e\u691c\u8a3c\u3092\u78ba\u8a8d\u3059\u308b\u306b\u306f\u3001\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u306b\u623b\u308b\u305f\u3081\u306b\u300c\u30b5\u30e1\u3078\u623b\u308b\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u305d\u3057\u3066\u3001\u518d\u3073\u300c\u65b0\u3057\u3044\u30b5\u30e1\u300d\u3092\u62bc\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u65b0\u3057\u3044\u30d5\u30a9\u30fc\u30e0\u306b\u3066\u3001\u300c\u540d\u524d\u300d\u6b04\u306b\u300c\u30bf\u30a4\u30ac\u30fc\u30b7\u30e3\u30fc\u30af\u300d\u3068\u5165\u529b\u3057\u3001\u300c\u4e8b\u5b9f\u300d\u306f\u7a7a\u767d\u306e\u307e\u307e\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u305d\u3057\u3066\u3001\u30b5\u30e1\u3092\u4f5c\u6210\u3059\u308b\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3068\u3001\u4ee5\u4e0b\u306e\u8b66\u544a\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656445b9daa94e2bdf7ad0b9\/139-0.png\" alt=\"Fact Presence Warning\" \/><\/div>\n<p>\u3053\u308c\u3089\u306e\u5909\u66f4\u306b\u3088\u308a\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u4fdd\u5b58\u3055\u308c\u308b\u30c7\u30fc\u30bf\u306e\u4e00\u8cab\u6027\u3092\u78ba\u4fdd\u3059\u308b\u305f\u3081\u306e\u3044\u304f\u3064\u304b\u306e\u691c\u8a3c\u304c\u3001\u3042\u306a\u305f\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u5c0e\u5165\u3055\u308c\u307e\u3057\u305f\u3002\u3053\u308c\u3067\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30e6\u30fc\u30b6\u30fc\u306b\u6ce8\u76ee\u3057\u3001\u3069\u306e\u30e6\u30fc\u30b6\u30fc\u304c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30c7\u30fc\u30bf\u3092\u5909\u66f4\u3067\u304d\u308b\u304b\u3092\u5b9a\u7fa9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u30b9\u30c6\u30c3\u30d76 \u2014 \u8a8d\u8a3c\u306e\u8ffd\u52a0<\/h2>\n<p>\u3042\u308b\u7a0b\u5ea6\u306e\u691c\u8a3c\u304c\u884c\u308f\u308c\u3066\u3044\u308b\u5834\u5408\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u4fdd\u5b58\u3055\u308c\u308b\u30c7\u30fc\u30bf\u306b\u3064\u3044\u3066\u306f\u4e00\u5b9a\u306e\u4fdd\u8a3c\u304c\u3042\u308a\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u3064\u3044\u3066\u306f\u3069\u3046\u3067\u3057\u3087\u3046\u304b\uff1f\u3082\u3057\u8ab0\u3067\u3082\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u8ffd\u52a0\u3067\u304d\u306a\u3044\u3088\u3046\u306b\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u8a31\u53ef\u3055\u308c\u305f\u30e6\u30fc\u30b6\u30fc\u306e\u307f\u304c\u30b5\u30e1\u3092\u8ffd\u52a0\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u3001\u3044\u304f\u3064\u304b\u306e\u8a8d\u8a3c\u63aa\u7f6e\u3092\u8ffd\u52a0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u3092\u884c\u3046\u306b\u306f\u3001http_basic_authenticate_with\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3001\u30e6\u30fc\u30b6\u30fc\u3092\u8a8d\u8a3c\u3059\u308b\u305f\u3081\u306e\u30e6\u30fc\u30b6\u30fc\u540d\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u7d44\u307f\u5408\u308f\u305b\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>Rails\u3067\u306f\u3001bcrypt\u3084devise\u306e\u30b8\u30a7\u30e0\u3092\u4f7f\u7528\u3059\u308b\u306a\u3069\u3001\u30e6\u30fc\u30b6\u30fc\u306e\u8a8d\u8a3c\u3092\u884c\u3046\u65b9\u6cd5\u306f\u3044\u304f\u3064\u304b\u3042\u308a\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u4eca\u306e\u3068\u3053\u308d\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5168\u4f53\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u306b\u9069\u7528\u3055\u308c\u308b\u30e1\u30bd\u30c3\u30c9\u3092\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u306f\u3001\u5c06\u6765\u7684\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u4ed6\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u8ffd\u52a0\u3059\u308b\u5834\u5408\u306b\u5f79\u7acb\u3061\u307e\u3059\u3002<\/p>\n<p>CTRL+C\u3067\u30b5\u30fc\u30d0\u30fc\u3092\u505c\u6b62\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3042\u306a\u305f\u306eApplicationController\u3092\u5b9a\u7fa9\u3057\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">nano<\/span> app\/controllers\/application_controller.rb<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30af\u30e9\u30b9\u306e\u5b9a\u7fa9\u304c\u5185\u90e8\u306b\u3042\u308a\u3001\u4ed6\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u304c\u3053\u308c\u3092\u7d99\u627f\u3057\u307e\u3059\u3002<\/p>\n<div>~\/sharkapp\/app\/controllers\/application_controller.rb\u3092\u65e5\u672c\u8a9e\u3067\u8a00\u3044\u63db\u3048\u308b\u3068\u3001\u300c~\/sharkapp\/app\/controllers\/application_controller.rb\u300d\u3068\u306a\u308a\u307e\u3059\u3002<\/div>\n<pre class=\"post-pre\"><code>class ApplicationController &lt; ActionController::Base\r\nend\r\n<\/code><\/pre>\n<p>\u30e6\u30fc\u30b6\u30fc\u8a8d\u8a3c\u306e\u305f\u3081\u306b\u3001\u300chttp_basic_authenticate_with\u300d\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u3001\u30e6\u30fc\u30b6\u30fc\u540d\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u30cf\u30fc\u30c9\u30b3\u30fc\u30c9\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>\u4ee5\u4e0b\u306f\u65e5\u672c\u8a9e\u3067\u306e\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u30d1\u30e9\u30d5\u30ec\u30fc\u30ba\u3067\u3059\uff08\u3044\u304f\u3064\u304b\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u63d0\u793a\u3057\u307e\u3059\uff09\uff1a<br \/>\n1. ~\/sharkapp\/app\/controllers\/application_controller.rb \u3092\u30d1\u30e9\u30d5\u30ec\u30fc\u30ba\u3059\u308b\u3068\uff1a<br \/>\n\u300c~\/sharkapp\/app\/controllers\/application_controller.rb\u300d\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u65e5\u672c\u8a9e\u306b\u30d1\u30e9\u30d5\u30ec\u30fc\u30ba\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/div>\n<pre class=\"post-pre\"><code>class ApplicationController &lt; ActionController::Base\r\n  <mark>http_basic_authenticate_with name: 'sammy', password: 'shark', except: [:index, :show]<\/mark>\r\nend\r\n<\/code><\/pre>\n<p>\u3053\u3053\u3067\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u540d\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u63d0\u4f9b\u306b\u52a0\u3048\u3066\u3001\u8a8d\u8a3c\u304c\u5fc5\u8981\u3067\u306a\u3044\u30eb\u30fc\u30c8\u3067\u306e\u5236\u9650\u3082\u3057\u3066\u3044\u307e\u3059\u3002\u5177\u4f53\u7684\u306b\u306f\u3001index\u3068show\u3067\u3059\u3002\u3053\u308c\u3092\u9054\u6210\u3059\u308b\u5225\u306e\u65b9\u6cd5\u306f\u3001[:create, :update, :destroy] \u306e\u307f\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u3059\u3002\u3053\u306e\u65b9\u6cd5\u3067\u306f\u3001\u3059\u3079\u3066\u306e\u30e6\u30fc\u30b6\u30fc\u304c\u3059\u3079\u3066\u306e\u30b5\u30e1\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3001\u7279\u5b9a\u306e\u30b5\u30e1\u306e\u60c5\u5831\u3092\u8aad\u3080\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u30b5\u30a4\u30c8\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u5909\u66f4\u3059\u308b\u969b\u306b\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u30a2\u30af\u30bb\u30b9\u6a29\u3092\u8a3c\u660e\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u3088\u308a\u5805\u7262\u306a\u8a2d\u5b9a\u3067\u306f\u3001\u3053\u306e\u3088\u3046\u306b\u5024\u3092\u30cf\u30fc\u30c9\u30b3\u30fc\u30c9\u3059\u308b\u3053\u3068\u306f\u907f\u3051\u305f\u3044\u3082\u306e\u3067\u3059\u304c\u3001\u3053\u306e\u4f8b\u3067\u306f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30eb\u30fc\u30c8\u306b\u8a8d\u8a3c\u3092\u7d44\u307f\u8fbc\u3080\u65b9\u6cd5\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002Rails\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u30bb\u30c3\u30b7\u30e7\u30f3\u30c7\u30fc\u30bf\u3092\u30af\u30c3\u30ad\u30fc\u306b\u4fdd\u5b58\u3057\u307e\u3059\u3002\u6307\u5b9a\u3055\u308c\u305f\u30a2\u30af\u30b7\u30e7\u30f3\u3067\u8a8d\u8a3c\u3092\u884c\u3063\u305f\u5834\u5408\u3001\u540c\u3058\u30bb\u30c3\u30b7\u30e7\u30f3\u5185\u3067\u306f\u518d\u8a8d\u8a3c\u304c\u5fc5\u8981\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u7de8\u96c6\u304c\u7d42\u4e86\u3057\u305f\u3089\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\uff08app\/controllers\/application_controller.rb\uff09\u3092\u4fdd\u5b58\u3057\u3066\u9589\u3058\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u3067\u8a8d\u8a3c\u306e\u30c6\u30b9\u30c8\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>rails s\u307e\u305f\u306frails s &#8211;binding=your_server_ip\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u30b5\u30fc\u30d0\u30fc\u3092\u8d77\u52d5\u3057\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u306fhttp:\/\/localhost:3000\u307e\u305f\u306fhttp:\/\/your_server_ip:3000\u306e\u3044\u305a\u308c\u304b\u3067\u30a2\u30af\u30bb\u30b9\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u30e9\u30f3\u30c7\u30a3\u30f3\u30b0\u30da\u30fc\u30b8\u3067\u3001\u300c\u65b0\u3057\u3044\u30b7\u30e3\u30fc\u30af\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u4ee5\u4e0b\u306e\u8a8d\u8a3c\u30a6\u30a3\u30f3\u30c9\u30a6\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656445b9daa94e2bdf7ad0b9\/158-0.png\" alt=\"User Authentication\" \/><\/div>\n<p>\u30e6\u30fc\u30b6\u30fc\u540d\u306b&#8221;Sammy&#8221;\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u306b&#8221;Shark&#8221;\u3092\u5165\u529b\u3059\u308b\u3068\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306eapp\/controllers\/application_controller.rb\u306b\u8ffd\u52a0\u3057\u305f\u3053\u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u5b89\u5168\u306b\u65b0\u3057\u3044\u30b5\u30e1\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u73fe\u5728\u3001\u30c7\u30fc\u30bf\u306e\u691c\u8a3c\u3068\u57fa\u672c\u7684\u306a\u8a8d\u8a3c\u30b7\u30b9\u30c6\u30e0\u3092\u5099\u3048\u305f\u3001\u7a3c\u50cd\u3059\u308b\u30b5\u30e1\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u304a\u4f7f\u3044\u3044\u305f\u3060\u3044\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u7d50\u8ad6<\/h2>\n<p>\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u4f5c\u6210\u3057\u305fRails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u3001\u3055\u3089\u306a\u308b\u958b\u767a\u306b\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u51fa\u767a\u70b9\u3067\u3059\u3002\u3082\u3057Rails\u30a8\u30b3\u30b7\u30b9\u30c6\u30e0\u3092\u63a2\u7d22\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c6\u30fc\u30b7\u30e7\u30f3\u304c\u826f\u3044\u30b9\u30bf\u30fc\u30c8\u5730\u70b9\u3067\u3059\u3002<\/p>\n<p>\u3042\u306a\u305f\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u30cd\u30b9\u30c8\u30ea\u30bd\u30fc\u30b9\u3092\u8ffd\u52a0\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u3001\u300eRuby on Rails \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30cd\u30b9\u30c8\u30ea\u30bd\u30fc\u30b9\u306e\u4f5c\u6210\u65b9\u6cd5\u300f\u3092\u8aad\u3080\u3053\u3068\u3067\u3055\u3089\u306b\u5b66\u3076\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u30ac\u30a4\u30c9\u3067\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30e2\u30c7\u30eb\u3068\u30eb\u30fc\u30c8\u3092\u3069\u306e\u3088\u3046\u306b\u69cb\u7bc9\u3059\u308b\u304b\u3092\u8aac\u660e\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3055\u3089\u306b\u3001React\u306e\u3088\u3046\u306a\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u4f7f\u7528\u3057\u3066\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3092\u3088\u308a\u5805\u7262\u306b\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u65b9\u6cd5\u3092\u8abf\u3079\u308b\u3053\u3068\u3092\u304a\u52e7\u3081\u3057\u307e\u3059\u3002React\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3092\u5099\u3048\u305fRuby on Rails\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u3001\u300eRuby on Rails\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306eReact\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u65b9\u6cd5\u300f\u304c\u30ac\u30a4\u30c0\u30f3\u30b9\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u7570\u306a\u308b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u9078\u629e\u80a2\u3092\u63a2\u3057\u305f\u3044\u5834\u5408\u306f\u3001Ubuntu 20.04\u3067\u306eRuby on Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067PostgreSQL\u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u305f\u300cHow To Use PostgreSQL with Your Ruby on Rails Application on Ubuntu 20.04\u300d\u3082\u53c2\u7167\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002\u307e\u305f\u3001\u5f53\u793e\u306ePostgreSQL\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u30e9\u30a4\u30d6\u30e9\u30ea\u3082\u3054\u5229\u7528\u3044\u305f\u3060\u3051\u308c\u3070\u3001\u3053\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u64cd\u4f5c\u65b9\u6cd5\u306b\u3064\u3044\u3066\u3088\u308a\u8a73\u3057\u304f\u5b66\u3076\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001\u521d\u3081\u307e\u3057\u3066\u3002 Ruby\u3067\u66f8\u304b\u308c\u305fWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306eRails\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u958b\u767a\u306b\u304a\u3044\u3066\u5171\u901a\u306e\u76ee\u6a19\u304c\u3042\u308b\u5834\u5408\u3001\u4e00\u8cab\u6027\u306e\u3042\u308b\u30a2\u30d7\u30ed\u30fc\u30c1\u3092\u53d6\u308a\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u3001Rails\u306f\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3001\u72b6 [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,26],"class_list":["post-29","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-linux","tag-26"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Ubuntu 22.04\u3067Ruby on Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u306e\u65b9\u6cd5 - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"Ubuntu 22.04\u3067Ruby on Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u306e\u65b9\u6cd5\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\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.silicloud.com\/ja\/blog\/ubuntu-22-04\u3067ruby-on-rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ubuntu 22.04\u3067Ruby on Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u306e\u65b9\u6cd5\" \/>\n<meta property=\"og:description\" content=\"Ubuntu 22.04\u3067Ruby on Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u306e\u65b9\u6cd5\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04\u3067ruby-on-rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-17T13:15:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-31T04:30:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656445b9daa94e2bdf7ad0b9\/33-0.PNG\" \/>\n<meta name=\"author\" content=\"\u7d50\u8863, \u6625\u82b1\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u7d50\u8863, \u6625\u82b1\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"49\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%a7ruby-on-rails%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%a7ruby-on-rails%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/\",\"name\":\"Ubuntu 22.04\u3067Ruby on Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u306e\u65b9\u6cd5 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\"},\"datePublished\":\"2023-07-17T13:15:03+00:00\",\"dateModified\":\"2025-07-31T04:30:40+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/e52a686063ac76fd8cc6f539d41497ac\"},\"description\":\"Ubuntu 22.04\u3067Ruby on Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u306e\u65b9\u6cd5\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%a7ruby-on-rails%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%a7ruby-on-rails%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%a7ruby-on-rails%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/ja\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Ubuntu 22.04\u3067Ruby on Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u306e\u65b9\u6cd5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/e52a686063ac76fd8cc6f539d41497ac\",\"name\":\"\u7d50\u8863, \u6625\u82b1\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c74c6e2eb915a3c8e795b3934aa25a7333e0b38e7f1c7baf52785286ad51105e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c74c6e2eb915a3c8e795b3934aa25a7333e0b38e7f1c7baf52785286ad51105e?s=96&d=mm&r=g\",\"caption\":\"\u7d50\u8863, \u6625\u82b1\"},\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/author\/yuiharuka\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%a7ruby-on-rails%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Ubuntu 22.04\u3067Ruby on Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u306e\u65b9\u6cd5 - Blog - Silicon Cloud","description":"Ubuntu 22.04\u3067Ruby on Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u306e\u65b9\u6cd5\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\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.silicloud.com\/ja\/blog\/ubuntu-22-04\u3067ruby-on-rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5\/","og_locale":"ja_JP","og_type":"article","og_title":"Ubuntu 22.04\u3067Ruby on Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u306e\u65b9\u6cd5","og_description":"Ubuntu 22.04\u3067Ruby on Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u306e\u65b9\u6cd5\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","og_url":"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04\u3067ruby-on-rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-07-17T13:15:03+00:00","article_modified_time":"2025-07-31T04:30:40+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/656445b9daa94e2bdf7ad0b9\/33-0.PNG"}],"author":"\u7d50\u8863, \u6625\u82b1","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u7d50\u8863, \u6625\u82b1","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"49\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%a7ruby-on-rails%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/","url":"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%a7ruby-on-rails%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/","name":"Ubuntu 22.04\u3067Ruby on Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u306e\u65b9\u6cd5 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website"},"datePublished":"2023-07-17T13:15:03+00:00","dateModified":"2025-07-31T04:30:40+00:00","author":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/e52a686063ac76fd8cc6f539d41497ac"},"description":"Ubuntu 22.04\u3067Ruby on Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u306e\u65b9\u6cd5\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%a7ruby-on-rails%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%a7ruby-on-rails%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%a7ruby-on-rails%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/ja\/blog\/"},{"@type":"ListItem","position":2,"name":"Ubuntu 22.04\u3067Ruby on Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u306e\u65b9\u6cd5"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website","url":"https:\/\/www.silicloud.com\/ja\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/e52a686063ac76fd8cc6f539d41497ac","name":"\u7d50\u8863, \u6625\u82b1","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c74c6e2eb915a3c8e795b3934aa25a7333e0b38e7f1c7baf52785286ad51105e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c74c6e2eb915a3c8e795b3934aa25a7333e0b38e7f1c7baf52785286ad51105e?s=96&d=mm&r=g","caption":"\u7d50\u8863, \u6625\u82b1"},"url":"https:\/\/www.silicloud.com\/ja\/blog\/author\/yuiharuka\/"},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/ubuntu-22-04%e3%81%a7ruby-on-rails%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/29","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/comments?post=29"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/29\/revisions"}],"predecessor-version":[{"id":325656,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/29\/revisions\/325656"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/media?parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/categories?post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/tags?post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}