Skip to content

Conversation

@xdite
Copy link
Contributor

@xdite xdite commented Jun 19, 2014

官方第二次作業解答

@xdite xdite mentioned this pull request Jun 19, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看到這邊覺得很困惑, 看起來 form 有設一個參數 quantity 1,2,3,4,5 給 user選
但是送出之後 看起來是會往 checkout_carts_path 丟過去
但是我去看 carts controller 裡面的 checkout action 裡面好像沒有處理選擇的數字...

實際上畫面操作的時候 看起來後台也是當作是 數量 1 在計算..
不知道是否是這邊尚未寫完? 因為寫作業時 這邊卡很久, 所以很想知道怎麼解決
thanks

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

form_for 好像會依照給的path來決定是post(create)或patch(update)
是對著cart_item_path丟值的
可以在那頁按右鍵看原始碼,會看到patch
http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_for-label-Resource-oriented+style

<%= link_to cart_item_path(current_cart, item), :method => :delete do %>
似乎也沒有傳值,是在controller另外從session或cache要資料的
(有錯請指正XD)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants