Hidden data in form_for tag #7461

Closed
wants to merge 8 commits into
from

Conversation

Projects
None yet
1 participant
Contributor

homakov commented Aug 28, 2012

Before:

<%= form_tag({action: :authorize, controller: :charm}) do %>
<%=hidden_field_tag :client_id, @client.id %>
<%=hidden_field_tag :scope, @client.scope %>
...
<% end %>

now

<%= form_tag({action: :authorize_accept, controller: :charm}, hidden_data:{client_id: @client.id, scope: @client.scope}) do %>
...
<% end %>

Why adding it as parameter in form_for is a nice solution? because the only purpose of type=hidden is to add some parameters to request, only data payload and there is no difference where will you put this tag inside of form.
Also, we already have a <div style="margin:0;padding:0;display:inline"> to keep all our hidden datas there.

/cc @tenderlove @josevalim

@homakov homakov closed this Aug 28, 2012

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