我需要在一些頁面上顯示使用button_to
創建的兩個按鈕(例如:list/id1/edit
)並隱藏所有其他頁面上的一個按鈕(例如:list/new
)。我有這個:隱藏按鈕,如果你在某些頁面
= button_link t("list.save"), list_path(@list.save_id), class: "button"
= button_link t("list.cancel"), list_path(@list.hashed_id), class: "button"
如何創建「如果你在頁面X顯示一個按鈕,否則 - 2按鈕」?
'current_page?'helper也提供這個。 Rails很酷! – arjun