{"id":169835,"date":"2013-02-18T17:19:03","date_gmt":"2013-02-18T13:19:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=169835"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=169835","title":{"rendered":"<span class=\"post_title\">Routing \u0432 Rails<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<i>\u0411\u043e\u043b\u044c\u0448\u0430\u044f \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u0442\u0435\u043c\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 Rails \u043f\u043e\u0434\u0432\u0438\u0433\u043b\u0430 \u043c\u0435\u043d\u044f \u043d\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u0438\u043c \u044f\u0437\u044b\u043a\u043e\u043c \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u044b \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0443 \u043b\u044e\u0434\u0435\u0439, \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0432\u0448\u0438\u0445\u0441\u044f \u0441\u043e \u00ab\u0428\u041f\u0410\u041b\u041e\u0419\u00bb \u0432 \u043b\u0438\u0446\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438. <\/i><br \/>  <a name=\"habracut\"><\/a><br \/>  Rails \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0433\u0438\u0431\u043a\u0438\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u043e\u0441\u043d\u043e\u0432\u043e\u0439 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432(<b>resources<\/b>) \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u043f\u0443\u0442\u0438(<b>match<\/b>) \u044d\u0442\u0438\u043c \u0434\u0432\u0443\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0435\u043b\u0435\u043d\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.  <\/p>\n<ul>\n<li> <b>Match<\/b> \u2013 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043f\u0443\u0442\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u043b\u044e\u0434\u0438 \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Rails \u043d\u0435 \u0443\u0442\u0440\u0443\u0436\u0434\u0430\u044e\u0442 \u0441\u0435\u0431\u044f \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 match \u0432\u0435\u0437\u0434\u0435. \u042f \u0441\u0447\u0438\u0442\u0430\u044e \u044d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u0440\u0430\u0437, \u0438 \u0434\u0432\u0430 \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e\u043c\u0443 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0415\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 User, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f {index, new, create, show, edit, update, destroy}. \u0414\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043c\u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 match.<br \/>  match \u2019\/user\u2019=&gt;\u2019user#index\u2019<br \/>  match \u2019\/user\/new\u2019=&gt;\u2019user#new\u2019<br \/>  match \u2019\/user\/create\/:id\u2019=&gt;\u2019user#create\u2019<br \/>  \u2026<br \/>  \u0438 \u0442.\u0434. <br \/>  \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043c\u043e\u0436\u043d\u043e, \u043d\u043e \u043a\u0430\u043a-\u0442\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445 \u043a\u0430\u0436\u0434\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0435\u0435\u0441\u044f \u043a \u043e\u0434\u043d\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0434\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439 match, \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b HTTP \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 {GET, POST, PUT, DELETE}. \u041d\u0435 \u043f\u043b\u043e\u0445\u043e \u0431\u044b \u043d\u0430\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u044d\u0442\u0438\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0438 \u0442\u0443\u0442 \u043c\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 resources.  <\/li>\n<li><b>Resources<\/b> \u2013 \u042d\u0442\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f HTTP \u043c\u0435\u0442\u043e\u0434\u044b {GET, POST, PUT, DELETE}. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c resources :users \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u043a \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443 User:<br \/> <br \/>\n<table>\n<tr>\n<td>\u041c\u0435\u0442\u043e\u0434 HTTP  <\/td>\n<td>\u041f\u0443\u0442\u044c  <\/td>\n<td>\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435  <\/td>\n<td>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c  <\/td>\n<\/tr>\n<tr>\n<td>GET   <\/td>\n<td> \/users   <\/td>\n<td>index   <\/td>\n<td>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439   <\/td>\n<\/tr>\n<tr>\n<td>GET   <\/td>\n<td>\/users\/new   <\/td>\n<td>new   <\/td>\n<td>\u041d\u043e\u0432\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c   <\/td>\n<\/tr>\n<tr>\n<td>POST   <\/td>\n<td>\/users   <\/td>\n<td>create   <\/td>\n<td>\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c\/\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f   <\/td>\n<\/tr>\n<tr>\n<td>GET    <\/td>\n<td>\/users\/:id   <\/td>\n<td>show   <\/td>\n<td>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 user.id=:id   <\/td>\n<\/tr>\n<tr>\n<td>GET   <\/td>\n<td>\/users\/:id\/edit   <\/td>\n<td>edit   <\/td>\n<td>\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 user.id=:id   <\/td>\n<\/tr>\n<tr>\n<td>PUT   <\/td>\n<td>\/users\/:id   <\/td>\n<td>update   <\/td>\n<td>\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c\/\u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 user.id=:id   <\/td>\n<\/tr>\n<tr>\n<td>DELETE   <\/td>\n<td>\/users\/:id   <\/td>\n<td>destroy   <\/td>\n<td>\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 user.id=:id   <\/td>\n<\/tr>\n<\/table>\n<p>  \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 User \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f {index, new, create, show, edit, update, destroy}. <\/p>\n<p>  \u0412\u0441\u0451 \u0432\u0440\u043e\u0434\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u043d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u0441 \u043b\u0438\u0447\u043d\u044b\u043c \u043a\u0430\u0431\u0438\u043d\u0435\u0442\u043e\u043c\/\u043f\u0440\u043e\u0444\u0438\u043b\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0440\u043e\u0444\u0438\u043b\u044e \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u0435\u0441\u043b\u0438 \u0432\u0437\u044f\u0442\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 resources :users, \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044e show \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \/user\/:id, \u043d\u043e \u0437\u0430\u0447\u0435\u043c \u043d\u0430\u043c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c id \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438 \u0435\u0433\u043e id \u0443\u0436\u0435 \u043b\u0435\u0436\u0438\u0442 \u0432 cookies, \u0434\u0430 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u043b\u0443\u0447\u0448\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0435 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 user\/:id \u0430 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 \/profile, \u0442\u0443\u0442 \u043d\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c match, \u043f\u043e\u0441\u043b\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f resources :users, \u043f\u0438\u0448\u0435\u043c match \u2018\/profile\u2019=&gt;\u2019users#show\u2019, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 \/profile \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u043c\u0435\u0442\u043e\u0434 show \u0443 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 users. \u0423\u0434\u043e\u0431\u043d\u043e, \u043d\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0437\u043d\u0430\u0435\u043c \u0447\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0449\u0435, \u0432\u043c\u0435\u0441\u0442\u043e resources :users \u043f\u0438\u0448\u0435\u043c resources :user \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0442\u0435\u0445 \u0447\u0442\u043e \u0431\u044b\u043b\u0438 \u0443 resources :users.  <\/p>\n<table>\n<tr>\n<td>\u041c\u0435\u0442\u043e\u0434 HTTP<\/td>\n<td>\u041f\u0443\u0442\u044c<\/td>\n<td>\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435<\/td>\n<td>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c<\/td>\n<\/tr>\n<tr>\n<td>GET<\/td>\n<td>\/user\/new<\/td>\n<td>new<\/td>\n<td>\u041d\u043e\u0432\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c<\/td>\n<\/tr>\n<tr>\n<td>POST<\/td>\n<td>\/user<\/td>\n<td>create<\/td>\n<td>\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c\/\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/td>\n<\/tr>\n<tr>\n<td>GET<\/td>\n<td>\/user<\/td>\n<td>show<\/td>\n<td>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/td>\n<\/tr>\n<tr>\n<td>GET<\/td>\n<td>\/user\/edit<\/td>\n<td>edit<\/td>\n<td>\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/td>\n<\/tr>\n<tr>\n<td>PUT   <\/td>\n<td>\/user   <\/td>\n<td>update   <\/td>\n<td>\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c\/\u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f   <\/td>\n<\/tr>\n<tr>\n<td>DELETE   <\/td>\n<td>\/user   <\/td>\n<td>destroy   <\/td>\n<td>\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f   <\/td>\n<\/tr>\n<\/table>\n<p>  \u0418\u0437 \u0432\u0441\u0435\u0433\u043e \u0432\u044b\u0448\u0435\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u0447\u0442\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c resources :users \u2013 \u043d\u0430\u0434\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044f \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 User \u0438 resources :user \u2013 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043e\u0434\u043d\u0438\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c User.  <\/li>\n<\/ul>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0448\u0430\u0433 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043d\u0430\u043c \u044d\u0442\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043d\u0430\u0448\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445. \u041c\u043e\u0436\u043d\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0442\u0438\u043f\u0430 &lt;%=link_to \u2018\u041d\u043e\u0432\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u2019, :controller=&gt;:user, :action=&gt;:new %&gt; \u0438\u043b\u0438 &lt;%=link_to \u2018\u041d\u043e\u0432\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u2019, \u2018\/user\/new\u2019%&gt; \u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0445\u044d\u043b\u043f\u0435\u0440\u044b, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0443\u0442\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f resources :users  <\/p>\n<table>\n<tr>\n<td>\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435   <\/td>\n<td>\u0425\u044d\u043b\u043f\u0435\u0440   <\/td>\n<\/tr>\n<tr>\n<td>index   <\/td>\n<td>users_path   <\/td>\n<\/tr>\n<tr>\n<td>new   <\/td>\n<td>new_user_path   <\/td>\n<\/tr>\n<tr>\n<td>create   <\/td>\n<td>users_path   <\/td>\n<\/tr>\n<tr>\n<td>show   <\/td>\n<td>user_path(:id)   <\/td>\n<\/tr>\n<tr>\n<td>edit   <\/td>\n<td>edit_user_path(:id)   <\/td>\n<\/tr>\n<tr>\n<td>update   <\/td>\n<td>user_path(:id)   <\/td>\n<\/tr>\n<tr>\n<td>destroy   <\/td>\n<td>user_path(:id)   <\/td>\n<\/tr>\n<\/table>\n<p>  \u0414\u043b\u044f resources :user  <\/p>\n<table>\n<tr>\n<td>\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435   <\/td>\n<td>\u0425\u044d\u043b\u043f\u0435\u0440   <\/td>\n<\/tr>\n<tr>\n<td>new   <\/td>\n<td>new_user_path   <\/td>\n<\/tr>\n<tr>\n<td>create   <\/td>\n<td>user _path   <\/td>\n<\/tr>\n<tr>\n<td>show   <\/td>\n<td>user _path   <\/td>\n<\/tr>\n<tr>\n<td>edit   <\/td>\n<td>edit_user_path   <\/td>\n<\/tr>\n<tr>\n<td>update   <\/td>\n<td>user _path   <\/td>\n<\/tr>\n<tr>\n<td>destroy   <\/td>\n<td>user _path   <\/td>\n<\/tr>\n<\/table>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0438\u043c\u0435\u0435\u043c \u0441\u043a\u043b\u0430\u0434 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043b\u0435\u0436\u0438\u0442 \u0442\u043e\u0432\u0430\u0440, \u0441\u0432\u044f\u0437\u044c \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d \u043a\u043e \u043c\u043d\u043e\u0433\u0438\u043c.  <\/p>\n<pre><code class=\"ruby\">class Storage &lt; ActiveRecord::Base   has_many :products end   class Product &lt; ActiveRecord::Base   belongs_to :storage end <\/code><\/pre>\n<p>  \u0432 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043c\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439  <\/p>\n<pre><code class=\"ruby\">resources :storages do   resources :products end <\/code><\/pre>\n<p>  \u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432  <\/p>\n<table>\n<tr>\n<td>\u041c\u0435\u0442\u043e\u0434 HTTP   <\/td>\n<td>\u041f\u0443\u0442\u044c   <\/td>\n<td>\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435   <\/td>\n<\/tr>\n<tr>\n<td>GET   <\/td>\n<td>\/storages\/:storage_id\/products   <\/td>\n<td>index   <\/td>\n<\/tr>\n<tr>\n<td>GET   <\/td>\n<td>\/storages\/:storage_id\/products\/new   <\/td>\n<td>new   <\/td>\n<\/tr>\n<tr>\n<td>POST   <\/td>\n<td>\/storages\/:storage_id\/products   <\/td>\n<td>create   <\/td>\n<\/tr>\n<tr>\n<td>GET   <\/td>\n<td>\/storages\/:storage_id\/products\/:id   <\/td>\n<td>show   <\/td>\n<\/tr>\n<tr>\n<td>GET   <\/td>\n<td>\/storages\/:storage_id\/products \/:id\/edit   <\/td>\n<td>edit   <\/td>\n<\/tr>\n<tr>\n<td>PUT   <\/td>\n<td>\/storages\/:storage_id\/products \/:id   <\/td>\n<td>update   <\/td>\n<\/tr>\n<tr>\n<td>DELETE   <\/td>\n<td>\/storages\/:storage_id\/products \/:id   <\/td>\n<td>destroy   <\/td>\n<\/tr>\n<\/table>\n<p>  \u0412\u0441\u0451 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e, \u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441, \u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u044b \u043b\u0438 \u043c\u044b \u044d\u0442\u0438\u043c\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c\u0438 {index, new, create, show, edit, update, destroy}, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044f \u0440\u0435\u0448\u0438\u043b \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u043c\u0443 license \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435. \u041c\u043d\u0435 \u043d\u0430\u0434\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f resources :user, \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0431\u043b\u043e\u043a member \u0432\u043d\u0443\u0442\u0440\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430  <\/p>\n<pre><code class=\"ruby\">resources :user   member do     get \u2018license\u2019   end end <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u043f\u0443\u0442\u044c \/user\/license \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 license \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 User. \u0422\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b Post, Put, Delete. \u0415\u0441\u043b\u0438 \u0432 \u0431\u043b\u043e\u043a\u0435 member, \u043a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0443 \u0437\u0430\u043f\u0438\u0441\u0438   <\/p>\n<pre><code class=\"ruby\">resources :user     get \u2018license\u2019, :on=&gt;:member end <\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043c\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439 \u043e Routing \u0432 Rails, \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u0431\u044b\u043b\u0430 \u043b\u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0438 \u0435\u0441\u0442\u044c \u043b\u0438 \u0441\u043c\u044b\u0441\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e \u0442\u0435\u043c\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 rails? \u0418 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u043a\u0440\u0438\u0442\u0438\u043a\u0430 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f!    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/169835\/\"> http:\/\/habrahabr.ru\/post\/169835\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<i>\u0411\u043e\u043b\u044c\u0448\u0430\u044f \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u0442\u0435\u043c\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 Rails \u043f\u043e\u0434\u0432\u0438\u0433\u043b\u0430 \u043c\u0435\u043d\u044f \u043d\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u0438\u043c \u044f\u0437\u044b\u043a\u043e\u043c \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u044b \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0443 \u043b\u044e\u0434\u0435\u0439, \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0432\u0448\u0438\u0445\u0441\u044f \u0441\u043e \u00ab\u0428\u041f\u0410\u041b\u041e\u0419\u00bb \u0432 \u043b\u0438\u0446\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438. <\/i>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-169835","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/169835","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=169835"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/169835\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=169835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=169835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=169835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}