Skip to content

Instantly share code, notes, and snippets.

View aclel's full-sized avatar

Andrew Cleland aclel

View GitHub Profile
@aclel
aclel / _feed_item.html.erb
Last active August 29, 2015 14:06
Polymorphic Form Rendering
<!-- This partial is shared by two classes - Product and Request. A comments form needs to be rendered in this file. -->
<!-- This line is not correct. I think something needs to be passed to it? It needs to create a form for a comment for the
feed item. -->
<%= render "comments/form" %>
@aclel
aclel / _product_form.html.erb
Last active August 29, 2015 14:05
Rails Nested s3_file_field Form
# Should a new Product with multiple images
# Currently only one of the images is being uploaded into the database, but all images are being uploaded to S3
<%= form_for @product, :html => {:class => 'expanding', multipart: true} do |f| %>
<%= f.text_area :name %>
<%= f.fields_for :images, Image.new do |im| %>
<%= im.s3_file_field :image, :multiple => true, :class => 'js-s3_file_field' %>
<%= im.hidden_field :id %>
<%= im.hidden_field :imageable_type %>
<%= im.hidden_field :imageable_id %>
<% end %>