{"id":7588,"date":"2019-11-28T19:46:59","date_gmt":"2019-11-28T10:46:59","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=7588"},"modified":"2023-05-27T22:58:44","modified_gmt":"2023-05-27T13:58:44","slug":"%e3%80%90ruby-on-rails%e3%80%91%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e7%9f%a5%e8%ad%98%ef%bc%88config-routes-rb%ef%bc%89","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=7588","title":{"rendered":"\u3010Ruby on Rails\u3011\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306b\u3064\u3044\u3066\u306e\u77e5\u8b58\uff08config\/routes.rb\u3001collection\u3001member\u306a\u3069\uff09"},"content":{"rendered":"<h2>\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3068\u306f\uff1f<\/h2>\n<p>\u3069\u306eURL\u3078\u3069\u306eHTTP\u30e1\u30bd\u30c3\u30c9\u3067\u30a2\u30af\u30bb\u30b9\u3055\u308c\u305f\u3089\u3069\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3084\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u547c\u3073\u51fa\u3057\u305f\u3044\u304b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\n<h2>config\/routes.rb\u306b\u3064\u3044\u3066<\/h2>\n<p>Rails\u306b\u304a\u3044\u3066\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u8a2d\u5b9a\u3092\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306b\u306a\u308a\u307e\u3059\u3002<span style=\"color: #ff0000;\"><strong>\u300crails g controller \u30e2\u30c7\u30eb\u540d\u300d<\/strong><\/span>\u3068\u3044\u3046\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u81ea\u52d5\u751f\u6210\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u305f\u3089\u81ea\u52d5\u7684\u306b\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u8a2d\u5b9a\u3092\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u3093\u3067\u304f\u308c\u307e\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001rails g controller\u3067\u751f\u6210\u3055\u308c\u308b\u81ea\u52d5\u8a2d\u5b9a\u306f<span style=\"color: #ff0000;\"><strong>\u6700\u4f4e\u9650\u307e\u305a\u30a2\u30d7\u30ea\u3068\u3057\u3066\u52d5\u304f\u72b6\u614b\u306e\u8a2d\u5b9a\u306b\u904e\u304e\u305a\u3001\u9069\u5207\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u8a2d\u5b9a\u306f\u958b\u767a\u8005\u81ea\u8eab\u304c\u884c\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/strong><\/span>\u3057\u3063\u304b\u308a\u3068\u66f8\u304d\u65b9\u3092\u7406\u89e3\u3057\u3066\u5b9f\u88c5\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>config\/routes.rb\u3092\u69cb\u9020\u5316\u3059\u308b\u305f\u3081\u306e\u8a18\u8ff0\u65b9\u6cd5<\/h2>\n<h3>scope<\/h3>\n<p>\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u8272\u3005\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u30d6\u30ed\u30c3\u30af\u5185\u306e\u5b9a\u7fa9\u306b\u4e00\u5b9a\u306e\u5236\u7d04\u3092\u304b\u3051\u307e\u3059\u3002\u901a\u5e38\u306e\u5229\u7528\u3067\u3042\u308c\u3070<span style=\"color: #ff0000;\"><strong>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306e\u30d5\u30a9\u30eb\u30c0\u69cb\u6210\u3092\u5909\u3048\u305a\u306bURL\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/strong><\/span><\/p>\n<h4>\u4f8b<\/h4>\n<pre class=\"lang:default decode:true \">scope :admin do\r\n  resources :tasks\r\nend<\/pre>\n<h4>\u751f\u6210\u3055\u308c\u308b\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0<\/h4>\n<pre class=\"lang:default decode:true\">GET\u3067\u300c\/admin\/tasks\/new\u300d\u306b\u300ctasks#new\u300d<\/pre>\n<h3>scope\u306e\u30aa\u30d7\u30b7\u30e7\u30f3<\/h3>\n<h4>:path\u30aa\u30d7\u30b7\u30e7\u30f3<\/h4>\n<p>URL\u968e\u5c64<\/p>\n<h4>:module\u30aa\u30d7\u30b7\u30e7\u30f3<\/h4>\n<p>\u30e2\u30b8\u30e5\u30fc\u30eb\u3001\u8a73\u3057\u304f\u306f\u4e0b\u8a18\u306e\u6bb5\u843d\u3067\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h4>:as\u30aa\u30d7\u30b7\u30e7\u30f3<\/h4>\n<p>URL\u30d1\u30fc\u30bf\u30f3\u540d\u306e\u30d7\u30ea\u30d5\u30a3\u30c3\u30af\u30b9<\/p>\n<h3>scope\u306emodule\u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u3064\u3044\u3066<\/h3>\n<p>module\u3092\u4f7f\u3046\u3053\u3068\u3067<span style=\"color: #ff0000;\"><strong>URL\u3092\u5909\u3048\u305a\u306b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u30d5\u30a9\u30eb\u30c0\u69cb\u6210\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd<\/strong><\/span>\u3067\u3059\u3002<\/p>\n<h4>\u4f8b<\/h4>\n<p>\u4e0b\u8a18\u4f8b\u3067\u306f\u300ccontroller\/admin\/TaskController.rb\u300d\u3068\u3044\u3046\u30d5\u30a9\u30eb\u30c0\u5206\u3051\u306b\u306a\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true\">scope module: :admin do\r\n  resources :tasks\r\nend<\/pre>\n<h4>\u751f\u6210\u3055\u308c\u308b\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0<\/h4>\n<p>URL\u3068\u3057\u3066\u306f\u901a\u5e38\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3068\u4f55\u3089\u5909\u308f\u308a\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"lang:default decode:true\">GET\u3067\u300c\/tasks\/new\u300d\u306b\u300ctasks#new\u300d<\/pre>\n<h3>namespace<\/h3>\n<p>URL\u968e\u5c64\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u3001URL\u30d1\u30bf\u30fc\u30f3\u540d\u306e\u30d7\u30ea\u30d5\u30a3\u30c3\u30af\u30b9\u306b\u307e\u3068\u3081\u3066\u5236\u7d04\u3092\u304b\u3051\u307e\u3059\u3002\u3064\u307e\u308a<span style=\"color: #ff0000;\"><strong>scope\u3068\u6bd4\u8f03\u3057\u3066<\/strong><strong>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306e\u30d5\u30a9\u30eb\u30c0\u69cb\u6210\u3092\u5909\u3048\u3064\u3064\u3001URL\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd<\/strong><\/span>\u3067\u3059\u3002<span style=\"color: #000000;\">scope\u3068\u9055\u3044\u3069\u3053\u304b\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3060\u3051\u5236\u7d04\u3092\u304b\u3051\u308b\u3068\u3044\u3046\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<\/span><\/p>\n<h4>\u4f8b<\/h4>\n<pre class=\"lang:default decode:true \">namespace :admin do\r\n  root \u2018tasks#index\u2019\r\n  get \u2018about\u2019, to: \u2018tasks#show\u2019\r\nend<\/pre>\n<h4>\u751f\u6210\u3055\u308c\u308b\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0<\/h4>\n<pre class=\"lang:default decode:true\">\u300c\/admin\u300d\u304c\u300c\u30eb\u30fc\u30c8URL\u300d\r\n\u300c\/admin\/about\u300d\u304c\u300ctasks\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u300d\u306e\u300cshow\u30a2\u30af\u30b7\u30e7\u30f3\u300d\u3092\u6307\u3059\u3002<\/pre>\n<h3>controller<\/h3>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<h2>config\/routes.rb\u3092\u3046\u307e\u304f\u6574\u7406\u3059\u308b\u30b3\u30c4<\/h2>\n<p>\u30a2\u30d7\u30ea\u306e\u6a5f\u80fd\u304c\u5897\u3048\u3066\u304f\u308b\u3068routes.rb\u306e\u5185\u5bb9\u304c\u3060\u3093\u3060\u3093\u898b\u306b\u304f\u304f\u306a\u3063\u3066\u304d\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u305d\u308c\u3067\u3082\u898b\u3084\u3059\u3055\u3092\u4fdd\u3064\u305f\u3081\u306b\u306f<span style=\"color: #ff0000;\"><strong>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5358\u4f4d\u3067\u6574\u7406\u3059\u308b<\/strong><\/span>\u3068\u7dba\u9e97\u306b\u6574\u7406\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002URL\u304c\u3069\u3046\u306a\u3063\u3066\u3044\u308b\u304b\u3088\u308a\u306f\u6a5f\u80fd\u5358\u4f4d\uff08\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u5358\u4f4d\uff09\u3067\u3069\u3046\u3044\u3046\u69cb\u9020\u306b\u306a\u3063\u3066\u3044\u308b\u304b\u304c\u308f\u304b\u308b\u65b9\u304c\u76f4\u611f\u7684\u306b\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u60c5\u5831\u3092\u7406\u89e3\u3067\u304d\u307e\u3059\u3002\u5177\u4f53\u7684\u306b\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u6574\u7406\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"lang:default decode:true \">Rails.application.routes.draw do\r\n  controller :\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9A do\r\n    \u30b3\u30f3\u30c8\u30ed\u30fc\u30e9A\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u60c5\u5831\r\n  end\r\n  controller :\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9B do\r\n    \u30b3\u30f3\u30c8\u30ed\u30fc\u30e9B\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u60c5\u5831\r\n  end\r\nend<\/pre>\n<h2>config\/routes.rb\u3067\u8a18\u8ff0\u3059\u308b\u5185\u5bb9\u306e\u30d1\u30bf\u30fc\u30f3<\/h2>\n<div>\n<h3>get 'users\/index'<\/h3>\n<p>users\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306eindex\u30a2\u30af\u30b7\u30e7\u30f3\u306bGET\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u3059\u308b\u3002<span style=\"color: #ff0000;\"><strong>\u30a2\u30af\u30bb\u30b9\u3055\u305b\u308bURL\uff08http:\/\/\u25cb\u25cb\/users\uff09\u3068\u547c\u3076\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u304c\u4e00\u81f4\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u3053\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3059\u308b\u3068\u826f\u3044\u3067\u3057\u3087\u3046\u3002<\/strong><\/span>\u4e0a\u8a18\u306f\u7701\u7565\u7cfb\u3067\u3042\u308a\u4e0b\u8a18\u306e\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<div>\n<div>\n<pre class=\"lang:default decode:true\">get 'users\/index', to: 'users#index'<\/pre>\n<\/div>\n<\/div>\n<h3>get 'users' to:\u30d1\u30b9(users#index\u7b49\uff09<\/h3>\n<div>\n<div>\n<div><span style=\"color: #ff0000;\"><strong>\u30a2\u30af\u30bb\u30b9\u3055\u305b\u308bURL\uff08http:\/\/\u25cb\u25cb\/users\uff09\u3068\u547c\u3076\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u306e\u7d10\u4ed8\u3051\u3092\u5909\u3048\u305f\u3044\u5834\u5408<\/strong><\/span>\u306f\u3053\u306e\u3088\u3046\u306b\u7701\u7565\u305b\u305a\u306b\u8a18\u8ff0\u3059\u308b\u3068\u826f\u3044\u3067\u3057\u3087\u3046\u3002<\/div>\n<\/div>\n<h3>\u00a0root to: \u30d1\u30b9(users#index\u7b49\uff09<\/h3>\n<\/div>\n<\/div>\n<p>\u30a2\u30d7\u30ea\u306e\u7384\u95a2\u53e3\uff08http:\/\/localhost:3000)\u306b\u8868\u793a\u3055\u308c\u308b\u30da\u30fc\u30b8\u3092\u6307\u5b9a\u3059\u308b\u3002<span style=\"color: #ff0000;\"><strong>\u30d1\u30b9\u3092\u6307\u5b9a\u3059\u308b\u5834\u5408\u306f\u30d1\u30b9\u306e\u533a\u5207\u308a\u306f\u30b9\u30e9\u30c3\u30b7\u30e5\u3067\u306f\u306a\u304f#\u306b\u306a\u308b<\/strong><\/span>\u306e\u3067\u6ce8\u610f\u3067\u3059\u3002<\/p>\n<h3>resources\u00a0 :\u30ea\u30bd\u30fc\u30b9\u540d(users\u7b49\uff09<\/h3>\n<p>\u5168\u3066\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u306b\u95a2\u3059\u308b\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3092\u4e00\u62ec\u3067\u8a2d\u5b9a\u3057\u3066\u304f\u308c\u308b\u3002\u4e00\u767a\u30677\u3064\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u306b\u5bfe\u5fdc\u3059\u308b7\u3064\u306e\u30eb\u30fc\u30c8\u3092\u5b9a\u7fa9\u3067\u304d\u307e\u3059\u3002<\/p>\n<h4>:only\u30aa\u30d7\u30b7\u30e7\u30f3<\/h4>\n<p>resources\u306e\u4e2d\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u306e\u5bfe\u8c61\u3092\u7d5e\u3063\u3066\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n<h4>:except\u30aa\u30d7\u30b7\u30e7\u30f3<\/h4>\n<p>resources\u306e\u4e2d\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u306e\u5bfe\u8c61\u3092\u9664\u5916\u3057\u3066\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n<h4>resources\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\uff087\u3064\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u304c\u81ea\u52d5\u3067\u4f5c\u3089\u308c\u308b\u3002\u4e0b\u8a18\u306fuser\u3068\u3044\u3046\u30e2\u30c7\u30eb\u306e\u5834\u5408\uff09<\/h4>\n<table>\n<tbody>\n<tr>\n<th>\u6a5f\u80fd<\/th>\n<th>HTTP\u30e1\u30bd\u30c3\u30c9<\/th>\n<th>URL\u30d1\u30bf\u30fc\u30f3<\/th>\n<th>URL\u30d1\u30bf\u30fc\u30f3\u540d<\/th>\n<th>\u30d8\u30eb\u30d1\u30fc\u30e1\u30bd\u30c3\u30c9<\/th>\n<th>\u30a2\u30af\u30b7\u30e7\u30f3<\/th>\n<\/tr>\n<tr>\n<td>\u4e00\u89a7<\/td>\n<td>GET<\/td>\n<td>\/users<\/td>\n<td>users<\/td>\n<td>users_path<\/td>\n<td>index<\/td>\n<\/tr>\n<tr>\n<td>\u8a73\u7d30<\/td>\n<td>GET<\/td>\n<td>\/users\/:id<\/td>\n<td>user<\/td>\n<td>users_path<\/td>\n<td>show<\/td>\n<\/tr>\n<tr>\n<td>\u65b0\u898f\u767b\u9332<\/td>\n<td>GET<\/td>\n<td>\/users\/new<\/td>\n<td>new_user<\/td>\n<td>new_user_path<\/td>\n<td>new<\/td>\n<\/tr>\n<tr>\n<td>\u767b\u9332<\/td>\n<td>POST<\/td>\n<td>\/users<\/td>\n<td>users<\/td>\n<td>users_path<\/td>\n<td>create<\/td>\n<\/tr>\n<tr>\n<td>\u7de8\u96c6\u753b\u9762<\/td>\n<td>GET<\/td>\n<td>\/users\/:id\/edit<\/td>\n<td>edit_user<\/td>\n<td>edit_user_path<\/td>\n<td>edit<\/td>\n<\/tr>\n<tr>\n<td>\u66f4\u65b0<\/td>\n<td>PATCH\u307e\u305f\u306fPUT<\/td>\n<td>\/users\/:id<\/td>\n<td>user<\/td>\n<td>user_path<\/td>\n<td>update<\/td>\n<\/tr>\n<tr>\n<td>\u524a\u9664<\/td>\n<td>DELETE<\/td>\n<td>\/users\/:id<\/td>\n<td>user<\/td>\n<td>user_path<\/td>\n<td>destroy<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u3061\u306a\u307f\u306b\u3001\u4e0a\u8a18\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u8a2d\u5b9a\u306fREST-API\u306e\u57fa\u672c\u5f62\u306b\u3082\u306a\u308a\u307e\u3059\u3002REST\u306f\u4e0b\u8a18\u3067\u3082\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"fpxV1emK1w\"><p><a href=\"http:\/\/www.code-magagine.com\/?p=5872\">\u3010Web\u958b\u767a\u3011\u300cREST-API(RESTful)\u300d\u3068\u306f\uff1f<\/a><\/p><\/blockquote>\n<p><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" src=\"http:\/\/www.code-magagine.com\/?p=5872&#038;embed=true#?secret=fpxV1emK1w\" data-secret=\"fpxV1emK1w\" width=\"500\" height=\"282\" title=\"&#8220;\u3010Web\u958b\u767a\u3011\u300cREST-API(RESTful)\u300d\u3068\u306f\uff1f&#8221; &#8212; \u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30de\u30ac\u30b8\u30f3\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<h3>resources\u306e\u5165\u308c\u5b50\uff08\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u95a2\u4fc2\u306e\u3042\u308b\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\uff09<\/h3>\n<pre class=\"lang:default decode:true \">  resources :\u89aa do\r\n    resources :\u5b50\r\n  end<\/pre>\n<p>\u305d\u3046\u3059\u308b\u3068\u4e0b\u8a18\u306e\u3088\u3046\u306a\u89aa\u5b50\u95a2\u4fc2\u306e\u3042\u308b\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u304c\u51fa\u6765\u307e\u3059\u3002\u30c6\u30fc\u30d6\u30eb\u9593\u3067\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u8cbc\u3063\u305f\u5834\u5408\u3068\u304b\u3067\u306f\u9078\u629e\u80a2\u3068\u3057\u3066\u5165\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"lang:default decode:true \">         \u89aa_\u5b50 GET    \/\u89aa\/:\u89aa_id\/\u5b50(.:format)                                                \u89aa#index\r\n                          POST   \/\u89aa\/:\u89aa_id\/\u5b50(.:format)                                                \u89aa#create\r\n      new_\u89aa_\u5b50 GET    \/\u89aa\/:\u89aa_id\/\u5b50\/new(.:format)                                            \u89aa#new\r\n     edit_\u89aa_\u5b50 GET    \/\u89aa\/:\u89aa_id\/\u5b50\/:id\/edit(.:format)                                       \u89aa#edit\r\n          \u89aa_\u5b50 GET    \/\u89aa\/:\u89aa_id\/\u5b50\/:id(.:format)                                            \u89aa#show\r\n                          PATCH  \/\u89aa\/:\u89aa_id\/\u5b50\/:id(.:format)                                            \u89aa#update\r\n                          PUT    \/\u89aa\/:\u89aa_id\/\u5b50\/:id(.:format)                                            \u89aa#update\r\n                          DELETE \/\u89aa\/:\u89aa_id\/\u5b50\/:id(.:format)                                            \u89aa#destroy<\/pre>\n<h3>match<\/h3>\n<p>\u8907\u6570\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u540c\u3058URL\u306b\u7d10\u3065\u3051\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<h4>\u4f8b<\/h4>\n<pre class=\"lang:default decode:true \">match \u2018\/about\u2019, to: \u2018task#index\u2019,via: [:get,:post]\r\nmatch \u2018\/about\u2019, to: \u2018task#index\u2019,via: :all(\u5168\u3066\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u306b\u7d10\u4ed8\u3051\u308b\u3001\u6b63\u76f4\u3042\u307e\u308a\u4f7f\u3046\u6a5f\u4f1a\u306f\u306a\u3044)<\/pre>\n<p><span style=\"color: #ff0000;\"><strong>REST\u4ee5\u5916\u306e\u72ec\u81ea\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3067\u4f7f\u3044\u305f\u3044\u5834\u5408<\/strong><\/span>\u306fcollection(\u96c6\u5408)\u3068member(\u500b\u5225\uff09\u3092\u5229\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h2>collection<\/h2>\n<p>id\u306a\u3057\u306eURL\u306b\u5bfe\u3057\u3066\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u60c5\u5831\u3092\u8ffd\u52a0\u3067\u3044\u304d\u307e\u3059\u3002(\u81ea\u52d5\u3067\u8ffd\u52a0\u3055\u308c\u308b7\u3064\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u60c5\u5831\u4ee5\u5916\u306b\u8ffd\u52a0\u3057\u307e\u3059\u3002\uff09<\/p>\n<h3>\u901a\u5e38\u306e\u4f8b<\/h3>\n<h4>\u8a18\u8ff0\u65b9\u6cd5<\/h4>\n<pre class=\"lang:default decode:true\">resources :admin do\r\n  #\u5168\u30c7\u30fc\u30bf\u3092\u5bfe\u8c61\u3068\u3059\u308b\u5834\u5408(\u3064\u307e\u308a\u300c:id\u300d\u3092URL\u306b\u3064\u3051\u306a\u3044\u3002)\r\n  collection do\r\n    post: search1\r\n    post: search2\r\n  end\r\nend<\/pre>\n<h3>\u751f\u6210\u3055\u308c\u308b\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0<\/h3>\n<pre class=\"lang:default decode:true \">POST\u3067\u300c\/admin\/search1\u300d\u306b\u300cadmin#search1\u300d\r\nPOST\u3067\u300c\/admin\/search2\u300d\u306b\u300cadmin#search2\u300d<\/pre>\n<h3>collection\u306e\u7c21\u6613\u8868\u8a18\u4f8b<\/h3>\n<p>collection\u3092\u4f7f\u308f\u305a\u306b\u8a18\u8ff0\u3059\u308b\u3068\u4e0b\u8a18\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">resoucers : users do\r\n  post :another, action: :another_new,on : :new\r\nend<\/pre>\n<h4>on: :\u8ffd\u52a0\u3057\u305f\u3044\u30a2\u30af\u30b7\u30e7\u30f3<\/h4>\n<p>\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0URL\u3092\u8ffd\u52a0\u3057\u305f\u3044\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p>\u4e0b\u8a18\u306e\u3088\u3046\u306a\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u304c\u751f\u6210\u3055\u308c\u3066\u3044\u307e\u3059\u3002new\u306e\u4e0b\u968e\u5c64\u306b\u8ffd\u52a0\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">another_new_user POST   \/users\/new\/another(.:format)   users#another_new<\/pre>\n<h2>member<\/h2>\n<p><span style=\"color: #ff0000;\"><strong>\u7279\u5b9a\u306e\u30c7\u30fc\u30bf(:id)\u306b\u5bfe\u3057\u3066URL\u3092\u751f\u6210\u3057\u305f\u3044\u5834\u5408<\/strong><\/span>\u306b\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<h3>\u4f8b<\/h3>\n<pre class=\"lang:default decode:true \">resources :admin do\r\n  #\u7279\u5b9a\u306e\u30c7\u30fc\u30bf\u3092\u5bfe\u8c61\u3068\u3059\u308b\u5834\u5408(\u3064\u307e\u308a\u300c:id\u300d\u3092URL\u306b\u3064\u3051\u308b\u3002\uff09\r\n  member do\r\n    get: getdata1\r\n    get: getdata2\r\n  end\r\nend<\/pre>\n<h3>\u751f\u6210\u3055\u308c\u308b\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0<\/h3>\n<pre class=\"lang:default decode:true  \">GET\u3067\u300c\/admin\/1(\u4efb\u610f)\/search1\u300d\u306b\u300cadmin#getdata1\u300d\r\nGET\u3067\u300c\/admin\/1(\u4efb\u610f)\/search2\u300d\u306b\u300cadmin#getdata2\u300d<\/pre>\n","protected":false},"excerpt":{"rendered":"\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3068\u306f\uff1f \u3069\u306eURL\u3078\u3069\u306eHTTP\u30e1\u30bd\u30c3\u30c9\u3067\u30a2\u30af\u30bb\u30b9\u3055\u308c\u305f\u3089\u3069\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3084\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u547c\u3073\u51fa\u3057\u305f\u3044\u304b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u3059\u3002 config\/routes.rb\u306b\u3064\u3044\u3066 Rails\u306b\u304a\u3044\u3066\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u8a2d\u5b9a\u3092\u3059\u308b\u30d5 [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[36],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/7588"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7588"}],"version-history":[{"count":27,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/7588\/revisions"}],"predecessor-version":[{"id":20540,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/7588\/revisions\/20540"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7588"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}