Skip to content

Instantly share code, notes, and snippets.

@mbklein
Last active May 10, 2019 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbklein/621f36b87a833938688fa882ed8ea0f2 to your computer and use it in GitHub Desktop.
Save mbklein/621f36b87a833938688fa882ed8ea0f2 to your computer and use it in GitHub Desktop.
<!-- events/show.html.erb -->
<%= form_tag(event_medfiles_release_many_path, method: 'POST') do %>
<%= hidden_field_tag 'id', @event.id %>
<% @event.medfiles.each do |medfile| %>
<%= render(partial: 'medfiles/release_form', object: medfile, as: 'medfile') %>
<% end %>
<%= submit_tag 'Do The Thing' %>
<%= end %>
<!-- medfiles/_release_form.html.erb -->
<div>
Whatever text you need and also stuff from medfile <%= medfile.id %>,
since <pre>medfile</pre> is a local variable in this context.
Also <%= check_box_tag "publish[]" value="#{medfile.id}" %>
</div>
# config/routes.rb
# (somewhere near your other event and/or medfile resources)
resources :events do
post 'medfiles/release_many', to: 'medfiles#release_many'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment