GitHub PullRequestReviewCommentEvent at 2014-02-18 11:55:23
Repository: amazon
Actor: GriwMF
Payload: {"comment":{"url":"https://api.github.com/repos/GriwMF/amazon/pulls/comments/9820508","id":9820508,"diff_hunk":"@@ -43,50 +44,40 @@ def update\n                                bill_addr_id: bill_addr,\n                                credit_card_id: credit_card)\n       @order.check_out!\n-      flash_message :success, 'Success! Your order is under processing.'                               \n+      flash_message :success, I18n.t('suc_ord_check_out')                             \n       \n     rescue ActiveRecord::RecordInvalid => ex\n       flash_message :danger, ex.message\n     rescue ActiveRecord::StatementInvalid => ex\n       flash_message :danger, ex.message\n-      flash_message :danger, \"Propably not enought books left:(\"     \n+      flash_message :danger, I18n.t('err_ord_check_out') \n     end\n     redirect_to root_path\n   end\n   \n+  # POST /orders/add_item/1\n   def add_item\n     book = Book.find(params[:id])\n     if (err = current_customer.cart.add_item(book).errors).any?\n       flash[:danger] =err.full_messages\n     else\n-      flash[:info] = \"Book was successefully added\"\n+      flash[:info] = I18n.t 'suc_book_added'\n       current_customer.cart.refresh_prices\n     end\n     redirect_to books_path\n   end\n \n+  # DELETE /orders/remove_item/1\n   def remove_item\n     current_customer.cart.order_items.find(params[:id]).destroy\n     redirect_to :back\n   end\n-  \n-  #PATCH /orders/1/ship\n-  def ship\n-    @order.ship\n-    redirect_to orders_path\n-  end\n-  \n-  #PATCH /orders/1/cancel\n-  def cancel\n-    @order.cancel\n-    redirect_to orders_path\n-  end\n \n   private\n     # Use callbacks to share common setup or constraints between actions.\n     def set_order\n       @order = current_customer.orders.find(params[:id])\n-      not_found unless @order.state == \"selecting\"\n+      not_found unless @order.state == 'in_progress'","path":"app/controllers/orders_controller.rb","position":82,"original_position":82,"commit_id":"a6c9eeff3fe73cbec1c6aa994627951990777d1f","original_commit_id":"9992c76964ed65ced54275717a862628dcc407fb","user":{"login":"GriwMF","id":6000392,"avatar_url":"https://gravatar.com/avatar/b2621cf4b487d692b018a216866c022a?d=https%3A%2F%2Fidenticons.github.com%2F349f549f85c42ea6b5d1e51a4a205bab.png&r=x","gravatar_id":"b2621cf4b487d692b018a216866c022a","url":"https://api.github.com/users/GriwMF","html_url":"https://github.com/GriwMF","followers_url":"https://api.github.com/users/GriwMF/followers","following_url":"https://api.github.com/users/GriwMF/following{/other_user}","gists_url":"https://api.github.com/users/GriwMF/gists{/gist_id}","starred_url":"https://api.github.com/users/GriwMF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GriwMF/subscriptions","organizations_url":"https://api.github.com/users/GriwMF/orgs","repos_url":"https://api.github.com/users/GriwMF/repos","events_url":"https://api.github.com/users/GriwMF/events{/privacy}","received_events_url":"https://api.github.com/users/GriwMF/received_events","type":"User","site_admin":false},"body":"не так, ``not_found`` только когда состояние НЕ ``in_progress``. ``in_progress`` - это кода мы делаем покупки, добавляем, удаляем товары. Т.е. если мы, например, хотим обновить не корзину, а какой-то законченный заказ, то не-не-не.\r\n\r\n``и состояние лучше проверять вот так @order.in_progress?``\r\nО, прикольно, это оно замо догадается в state посмотреть или state_machine дбавляет эти методы?","created_at":"2014-02-18T11:55:23Z","updated_at":"2014-02-18T11:55:23Z","html_url":"https://github.com/GriwMF/amazon/pull/1#discussion_r9820508","pull_request_url":"https://api.github.com/repos/GriwMF/amazon/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/GriwMF/amazon/pulls/comments/9820508"},"html":{"href":"https://github.com/GriwMF/amazon/pull/1#discussion_r9820508"},"pull_request":{"href":"https://api.github.com/repos/GriwMF/amazon/pulls/1"}}}}