http://song-of-life.hatenablog.com/entry/2017/03/01/214957
こちらの記事を参考にbutton_toを実装しています。
<!-- ダメなパターン --> <%= button_to "戻る", :method => "get", :action => "index" %> <%= button_to "戻る", :action => "index" , :method => "get" %> <%= button_to "戻る", { :action => "index" , :method => "get" } %> <%= button_to "戻る", { :method => "get" }, :action => "index" %> <!-- OKなパターン --> <%= button_to "戻る", { :action => "index" }, :method => "get" %> <%= button_to "戻る", { :action => "index" }, { :method => "get" } %>
丸々引用させてもらいました。
今回聞きたいのは
<%= button_to "戻る", :method => "get", :action => "index" %>
がダメで、
<%= button_to "戻る", { :action => "index" }, :method => "get" %>
が何故動作するのでしょうか?
actionもmethodも同じハッシュのように見えます。
動作を見る限り、どっちかがハッシュでどっちかがハッシュではないということでしょうか?
分かる方居ましたらお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/01/21 09:39