I have a model called posts, and it has many attachments.
The attachments model is using paperclip.
I made a standalone model for creating attachments which
You are missing the :multipart option in your form definition:
<% @attachment = @post.attachments.build %>
<%= form_for @post, :html => { :multipart => true } do |f| %>
<% if @post.errors.any? %>
<%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:
<% @post.errors.full_messages.each do |msg| %>
- <%= msg %>
<% end %>
<% end %>
<%= f.label :name %>
<%= f.text_field :name %>
<%= f.label :description %>
<%= f.text_area :description %>
<%= f.fields_for :attachments, @attachment do |at_form| %>
<%= at_form.file_field :pclip %>
<% end %>
<%= f.submit %>
<% end %>
Also, your @posts variable should really be @post (single ActiveRecord instance as opposed to an array of ActiveRecord instances).