Completely agreed with the fact that GET parameters should be in the query URL.
But button\2 is actually more useful in the case of a POST/PUT/DELETE query IMHO, where params act as extra hidden fields.
Anyway, since it is phoenix_html.js which actually submits data, it could be conditional on the method so that GET is in the query parameter, and others are hidden fields.
I guess that’s what Rails does.
Cool thing about this is that method can be dynamic without having to rewrite the logic:
= button("content", to: "/example", method: method, params: params)
/ instead of
= if method == :get do
= button("content", to: "/example?#{params |> Enum.map(fn k, v -> "#{k}=#{v}" end) |> Enum.join("&")}"
- else
= button("content", to: "/example", method: method, params: params)






















