I am currently working with form in ruby on rails 3. So in my project form I have a button to sign users out of this project. However, the strange thing is, that the button_to
tag closes my whole form and i cannot use my submit button anymore.
So I tried a lot, but i do not understand why this happens.
So this is my form:
<%= form_for @project, html: { class: "form-horizontal project" } do |f| %>
<div>
<%= f.label :users, 'Project Users:', :class => 'control-label', style: 'margin-bottom: 20px' %>
<div>
<% @project.users.order('last_name').each do |user| %>
<div style="margin-bottom: 15px">
<%= user.name %>
<%= button_to 'Sign Out', sign_user_out_project_path(user_id: user.id, id: @project), method: :delete, class: 'btn btn-danger btn-xs pull-right', style:'margin-right: 600px; margin-top: -20px' %>
</div>
<% end %>
</div>
</div>
<%= f.submit nil, :class => 'btn btn-primary' %>
<%= link_to t('.cancel', :default => t("helpers.links.cancel")),
projects_path, :class => 'btn btn-default' %>
<% end %>
In my opinion this code looks fine, as all tags are perfectly closed. However, i think there might be some magic when using button_to
so maybe someone knows a better way to do what I want to do.
Thanks!
Aucun commentaire:
Enregistrer un commentaire