{"id":265985,"date":"2015-09-19T14:46:02","date_gmt":"2015-09-19T10:46:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=265985"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=265985","title":{"rendered":"\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043d\u0430 ruby on rails. \u0427\u0430\u0441\u0442\u044c 2"},"content":{"rendered":"<p>       \u0412 <a href=\"http:\/\/habrahabr.ru\/post\/266761\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438<\/a> \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b \u043f\u0440\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u0440\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b.<br \/>  \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043f\u0440\u043e:  <\/p>\n<ul>\n<li>REST<\/li>\n<li>gem responders<\/li>\n<li>\u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432<\/li>\n<li>\u0445\u043b\u0435\u0431\u043d\u044b\u0435 \u043a\u0440\u043e\u0448\u043a\u0438<\/li>\n<\/ul>\n<p>  \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439:  <\/p>\n<ul>\n<li>\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, <\/li>\n<li>\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, <\/li>\n<li>\u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e.<\/li>\n<\/ul>\n<p>  \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043b\u043e\u0433\u0438\u043a\u0443 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c:  <\/p>\n<ul>\n<li>\u0432\u044b\u0431\u043e\u0440 view \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445<\/li>\n<li>\u0432\u044b\u0437\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/li>\n<li>\u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439<\/li>\n<li>\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u044f\u043c\u0438<\/li>\n<\/ul>\n<p>  \u0411\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e. \u0412\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0442\u0430\u043a \u0436\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e rake \u043a\u043e\u043c\u0430\u043d\u0434. Rake \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u043f\u043e \u0441\u0443\u0442\u0438, \u0442\u0435 \u0436\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0438 \u043b\u043e\u0433\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438.<\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<h2>REST<\/h2>\n<p>  \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u0442\u044c\u0441\u044f \u0432 \u0442\u0435\u043e\u0440\u0438\u044e REST, \u0430 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432\u0435\u0449\u0438, \u0438\u043c\u0435\u044e\u0449\u0438\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u043a rails.<\/p>\n<p>  \u041e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0432\u0438\u0436\u0443, \u0447\u0442\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u043a\u0430\u043a \u043d\u0430\u0431\u043e\u0440 \u044d\u043a\u0448\u0435\u043d\u043e\u0432, \u0442.\u0435. \u043d\u0430 \u043b\u044e\u0431\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u043d\u043e\u0432\u044b\u0439 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 action.<\/p>\n<pre><code>resources :projects do   member do     get :create_act     get :create_article_waybill     get :print_packing_slips     get :print_distributions   end    collection do     get :print_packing_slips     get :print_distributions   end end  resources :buildings do   [:act, :waybill].each do |item|     post :&quot;create_#{item}&quot;     delete :&quot;remove_#{item}&quot;   end end <\/code><\/pre>\n<p>  \u0418\u043d\u043e\u0433\u0434\u0430 \u0441\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 GET \u0438 POST. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"http:\/\/habrahabr.ru\/company\/yandex\/blog\/265569\/\">\u00ab15 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0444\u0430\u043a\u0442\u043e\u0432 \u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c HTTP\u00bb<\/a>.<\/p>\n<p>  \u0412\u043e\u0437\u044c\u043c\u0435\u043c \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0441\u0435\u0441\u0441\u0438\u044f\u043c\u0438. \u041f\u043e \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u0437\u0430\u0434\u0430\u043d\u0438\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442:   <\/p>\n<ul>\n<li>\u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u043e\u0440\u043c\u0443 \u0432\u0445\u043e\u0434\u0430<\/li>\n<li>\u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u0438 \u0432\u043e\u0439\u0442\u0438 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443<\/li>\n<li>\u0432\u044b\u0439\u0442\u0438 \u0438\u0437 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/li>\n<li>\u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u043e\u043c, \u0442\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0434\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0432\u043e\u044e \u0441\u0435\u0441\u0441\u0438\u044e \u043d\u0430 \u0441\u0435\u0441\u0441\u0438\u044e \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/li>\n<\/ul>\n<p>  \u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441 session, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u044d\u043a\u0448\u0435\u043d\u0430\u043c\u0438: new, create, destroy, update. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430 \u0441\u0435\u0441\u0441\u0438\u0438.<\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043b\u043e\u0436\u043d\u0435\u0435. \u0415\u0441\u0442\u044c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 crud \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. <br \/>  \u041f\u0440\u043e\u0435\u043a\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0438\u043b\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u043c. \u041f\u0440\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u0430\u0442\u0443 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e 2 \u044d\u043a\u0448\u0435\u043d\u0430: \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0444\u043e\u0440\u043c\u044b \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0444\u043e\u0440\u043c\u044b. \u041f\u0435\u0440\u0432\u043e\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0435 \u0438 \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c 2 \u043d\u043e\u0432\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430 \u0432 ProjectsController. \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441 \u00ab\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u00bb. <\/p>\n<pre><code>resources :projects do   scope module: :projects do     resource :finish     # GET \/projects\/1\/finish\/new     # POST \/projects\/1\/finish   end end <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0441\u0442\u0430\u0442\u0443\u0441\u0430: \u0430 \u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u0432\u043e\u043e\u0431\u0449\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442?<\/p>\n<pre><code>class Web::Projects::FinishesController &lt; Web::Projects::ApplicationController   before_action :check_availability    def new   end    def create   end    private   def check_availability     redirect_to resource_project unless resource_project.can_finish?   end end <\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u0441 \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u043c\u0438 \u0444\u043e\u0440\u043c\u0430\u043c\u0438: \u043a\u0430\u0436\u0434\u044b\u0439 \u0448\u0430\u0433 \u2014 \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441.<\/p>\n<p>  \u0418\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439, \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u044d\u043a\u0448\u0435\u043d\u044b. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0431\u044b\u0432\u0430\u044e\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043d\u043e \u044d\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0440\u0435\u0434\u043a\u043e.<\/p>\n<h2>Responders<\/h2>\n<p>  <a href=\"https:\/\/github.com\/plataformatec\/responders\">Gem respongers<\/a> \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0443\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0443\u044e\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0443 \u0438\u0437 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432.  <\/p>\n<ul>\n<li>\u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434 \u044d\u043a\u0448\u0435\u043d\u043e\u0432 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u043c<\/li>\n<li>\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 flash \u043f\u0440\u0438 \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u0430\u0445 \u0438\u0437 \u043b\u043e\u043a\u0430\u043b\u0435\u0439<\/li>\n<li>\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043e\u0431\u0449\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u0431\u043e\u0440 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0430\u0439\u0437\u0435\u0440\u0430, \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438.<\/li>\n<\/ul>\n<pre><code>class Web::ApplicationController &lt; ApplicationController   self.responder = WebResponder # \u043f\u043e\u0442\u043e\u043c\u043e\u043a ActionController::Responder   respond_to :html end  class Web::UsersController &lt; Web::ApplicationController   def update     @user = User.find params[:id]     @user.update user_params     respond_with @user   end end  <\/code><\/pre>\n<p>  <\/p>\n<h2>\u0418\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432<\/h2>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0435\u0441\u0442\u044c \u0432 <a href=\"http:\/\/habrahabr.ru\/post\/136461\/\">\u0441\u0442\u0430\u0442\u044c\u0435 \u041a\u0438\u0440\u0438\u043b\u043b\u0430 \u041c\u043e\u043a\u0435\u0432\u043d\u0438\u043d\u0430<\/a>. <br \/>  \u0427\u0442\u043e-\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u044f \u0432\u0438\u0434\u0435\u043b \u0432 \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u043c \u0431\u043b\u043e\u0433\u0435, \u043d\u043e \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0443. \u0426\u0435\u043b\u044c \u044d\u0442\u043e\u0439 \u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0438 \u2014 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b.<\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e html. \u041f\u043e\u0442\u043e\u043c \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f ajax, \u0442\u0435 \u0436\u0435 html, \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0435\u0437 layout.<br \/>  \u041f\u043e\u0442\u043e\u043c \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f api \u0438 \u0432\u0442\u043e\u0440\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f api, \u043f\u0435\u0440\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438. Api \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u043b\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0442\u043e\u043a\u0435\u043d \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435, \u0430 \u043d\u0435 cookie. \u041f\u043e\u0442\u043e\u043c \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f rss \u043b\u0435\u043d\u0442\u044b, \u0434\u043b\u044f \u0433\u043e\u0441\u0442\u0435\u0439 \u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445, \u043f\u0440\u0438\u0447\u0435\u043c rss \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u043d\u0435 \u0443\u043c\u0435\u044e\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 cookies. \u0412 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 rss feed \u043d\u0443\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0442\u043e\u043a\u0435\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041f\u043e\u0441\u043b\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c js \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c json api \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u0441\u0435\u0441\u0441\u0438\u044e. \u0417\u0430\u0442\u0435\u043c \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0434\u0435\u043b \u0441\u0430\u0439\u0442\u0430 \u0441 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c layout \u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439. \u0422\u0430\u043a \u0436\u0435 \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0441 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 url.<\/p>\n<p>  \u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f. <br \/>  \u0412\u0441\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u0430\u043c: web, ajax, api\/v1, api\/v2, feed, web_api, promo.<br \/>  \u0418 \u0434\u043b\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0440\u043e\u0443\u0442\u044b \u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code>Rails.application.routes.draw do   scope module: :web do     resources :tasks do       scope module: :tasks do         resources :comments       end     end   end    namespace :api do     namespace :v1, defaults: { format: :json } do       resources :some_resources      end    end end  class Web::ApplicationController &lt; ApplicationController   include UserAuthentication # \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u0443\u044e \u0434\u043b\u044f web \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e   include Breadcrumbs # \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0445\u043b\u0435\u0431\u043d\u044b\u0435 \u043a\u0440\u043e\u0448\u043a\u0438, \u0437\u0430\u0447\u0435\u043c \u043e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b \u0432 api?    self.responder = WebResponder   respond_to :html  # \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u043c \u0432\u0441\u0435\u0433\u0434\u0430 \u0432 html    add_breadcrumb {{ url: root_path }}    # \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u043a\u0430\u0437\u0430 \u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0435   rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized    private    def user_not_authorized     flash[:alert] = &quot;You are not authorized to perform this action.&quot;     redirect_to(request.referrer || root_path)   end end  # \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0432 \u0440\u0435\u0441\u0443\u0440\u0441 task class Web::Tasks::ApplicationController &lt; Web::ApplicationController   # \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432\u043e view   helper_method :resource_task    add_breadcrumb {{ url: tasks_path }}   add_breadcrumb {{ title: resource_task, url: task_path(resource_task) }}    private    # \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430   def resource_task     @resource_task ||= Task.find params[:task_id]   end end  # \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441 class Web::Tasks::CommentsController &lt; Web::Tasks::ApplicationController   add_breadcrumb    def new     @comment = resource_task.comments.build     authorize @comment     add_breadcrumb   end    def create     @comment = resource_task.comments.build     authorize @comment     add_breadcrumb     attrs = comment_params.merge(user: current_user)     @comment.update attrs     CommentNotificationService.on_create(@comment)     respond_with @comment, location: resource_task   end end <\/code><\/pre>\n<p>  \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0433\u043b\u0443\u0431\u043e\u043a\u0430\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u2014 \u044d\u0442\u043e \u043f\u043b\u043e\u0445\u043e. \u041d\u043e \u044d\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u0430 \u043d\u0435 \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u043e\u0432. \u0422.\u0435. \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e \u0438\u043c\u0435\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c: Api::V1::Users::PostsController#create, POST \/api\/v1\/users\/1\/posts. \u0412\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e 2-\u043c\u044f \u0443\u0440\u043e\u0432\u043d\u044f\u043c\u0438: \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0440\u0435\u0441\u0443\u0440\u0441 \u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441. \u0422\u0430\u043a \u0436\u0435 \u0442\u0435 \u044d\u043a\u0448\u0435\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430, \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432\u044b\u0448\u0435. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 users \u0438 posts: \/api\/v1\/users\/1\/posts \u0438 \/api\/v1\/posts\/1<\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043f\u043e\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u2014 \u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u044b\u0431\u043e\u0440 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0415\u0441\u043b\u0438 \u0443 \u043a\u043e\u0433\u043e-\u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u0430\u043a \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0438\u043d\u0430\u0447\u0435, \u0442\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0439\u0442\u0435 \u0441\u0432\u043e\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<h2>\u0425\u043b\u0435\u0431\u043d\u044b\u0435 \u043a\u0440\u043e\u0448\u043a\u0438<\/h2>\n<p>  \u042f \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0445\u043b\u0435\u0431\u043d\u044b\u0445 \u043a\u0440\u043e\u0448\u0435\u043a, \u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u0430 \u043d\u0435 \u043f\u043e\u0434\u043e\u0448\u043b\u0430. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0441\u0434\u0435\u043b\u0430\u043b \u0441\u0432\u043e\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432.<\/p>\n<pre><code>class Web::ApplicationController &lt; ApplicationController   include Breadcrumbs   # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0445\u043b\u0435\u0431\u043d\u0443\u044e \u043a\u0440\u043e\u0448\u043a\u0443 \u0434\u043b\u044f \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435   # \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437 \u043b\u043e\u043a\u0430\u043b\u0438, \u043a\u043b\u044e\u0447 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430   # {{}} \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0431\u043b\u043e\u043a, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u0445\u044d\u0448   add_breadcrumb {{ url: root_path }} end  class Web::TasksController &lt; Web::ApplicationController   # \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0442\u043e\u0440\u0443\u044e \u0445\u043b\u0435\u0431\u043d\u0443\u044e \u043a\u0440\u043e\u0448\u043a\u0443   add_breadcrumb {{ url: tasks_path }}    def show     @task = Task.find params[:id]     # \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u0440\u043e\u0448\u043a\u0443 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430     add_breadcrumb model: @task     respond_with @task   end end  class Web::Tasks::ApplicationController &lt; Web::ApplicationController   # \u043a\u0440\u043e\u0448\u043a\u0438 \u0434\u043b\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432   add_breadcrumb {{ url: tasks_path }}   add_breadcrumb {{ title: resource_task, url: task_path(resource_task) }}    def resource_task; end # \u043e\u043f\u0443\u0441\u0442\u0438\u043c end  class Web::Tasks::CommentsController &lt; Web::Tasks::ApplicationController   # \u0442.\u043a. \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043b\u0438 url, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a   add_breadcrumb    def new     @comment = resource_task.comments.build     authorize @comment     add_breadcrumb # \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u043a\u0440\u043e\u0448\u043a\u0443 &quot;\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438&quot;   end end  # ru.yml ru:   breadcrumbs:     defaults:       show: &quot;%{model}&quot;       new: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438       edit: &quot;\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435: %{model}&quot;     web:       application:         scope: \u0413\u043b\u0430\u0432\u043d\u0430\u044f       tasks:         scope: \u0417\u0430\u0434\u0430\u0447\u0438         application:           scope: \u0417\u0430\u0434\u0430\u0447\u0438         comments:           scope: \u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code># app\/helpers\/application_helper.rb # \u0425\u044d\u043b\u043f\u0435\u0440, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u0439 \u043a\u0440\u043e\u0448\u043a\u0438 def render_breadcrumbs   return if breadcrumbs.blank? || breadcrumbs.one?   items = breadcrumbs.map do |breadcrumb|     title, url = breadcrumb.values_at :title, :url      item_class = []     item_class &lt;&lt; :active if breadcrumb == breadcrumbs.last      content_tag :li, class: item_class do       if url         link_to title, url       else         title       end     end   end    content_tag :ul, class: :breadcrumb do     items.join.html_safe   end end  # app\/controllers\/concerns\/breadcrumbs.rb module Breadcrumbs   extend ActiveSupport::Concern    included do     helper_method :breadcrumbs   end    class_methods do     def add_breadcrumb(&amp;block)       controller_class = self       before_action do         options = block ? instance_exec(&amp;block) : {}         title = options.fetch(:title) { controller_class.breadcrumbs_i18n_title :scope, options }         breadcrumbs &lt;&lt; { title: title, url: options[:url] }       end     end      def breadcrumbs_i18n_scope       [:breadcrumbs] | name.underscore.gsub('_controller', '').split('\/')     end      def breadcrumbs_i18n_title(key, locals = {})       default_key = &quot;breadcrumbs.defaults.#{key}&quot;       if I18n.exists? default_key         default = I18n.t default_key       end        I18n.t key, locals.merge(scope: breadcrumbs_i18n_scope, default: default)     end   end    def breadcrumbs     @_breadcrumbs ||= []   end    # \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u044d\u043a\u0448\u0435\u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430   def add_breadcrumb(locals = {})     key =         case action_name         when 'update' then 'edit'         when 'create' then 'new'         else action_name         end     title = self.class.breadcrumbs_i18n_title key, locals     breadcrumbs &lt;&lt; { title: title }   end end <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043f\u0440\u043e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438-\u0444\u043e\u0440\u043c\u0430\u043c\u0438.               <\/p>\n<div class=\"clear\"><\/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\/267233\/\"> http:\/\/habrahabr.ru\/post\/267233\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u0412 <a href=\"http:\/\/habrahabr.ru\/post\/266761\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438<\/a> \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b \u043f\u0440\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u0440\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b.<br \/>  \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043f\u0440\u043e:  <\/p>\n<ul>\n<li>REST<\/li>\n<li>gem responders<\/li>\n<li>\u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432<\/li>\n<li>\u0445\u043b\u0435\u0431\u043d\u044b\u0435 \u043a\u0440\u043e\u0448\u043a\u0438<\/li>\n<\/ul>\n<p>  \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439:  <\/p>\n<ul>\n<li>\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, <\/li>\n<li>\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, <\/li>\n<li>\u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e.<\/li>\n<\/ul>\n<p>  \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043b\u043e\u0433\u0438\u043a\u0443 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c:  <\/p>\n<ul>\n<li>\u0432\u044b\u0431\u043e\u0440 view \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445<\/li>\n<li>\u0432\u044b\u0437\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/li>\n<li>\u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439<\/li>\n<li>\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u044f\u043c\u0438<\/li>\n<\/ul>\n<p>  \u0411\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e. \u0412\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0442\u0430\u043a \u0436\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e rake \u043a\u043e\u043c\u0430\u043d\u0434. Rake \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u043f\u043e \u0441\u0443\u0442\u0438, \u0442\u0435 \u0436\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0438 \u043b\u043e\u0433\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438.<\/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-265985","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/265985","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=265985"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/265985\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=265985"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=265985"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=265985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}