<%= form_for [@comment.pin, @comment] do |f| %>
  <% if @comment.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(comment.errors.count, "error") %> prohibited this comment from being saved:</h2>

      <ul>
      <% @comment.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
      </ul>
    </div>
  <% end %>


  <div class="field">
    <%= f.label :content %>
    <%= f.text_field :content %>
  </div>

  <div class="field">
    <%= f.hidden_field :pin_id, :value => @comment.pin.id %>
  </div>

  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

<%= form_for [@pin, @comment] do |f| %>
  <% if @comment.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(comment.errors.count, "error") %> prohibited this comment from being saved:</h2>

      <ul>
      <% @comment.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
      </ul>
    </div>
  <% end %>


  <div class="field">
    <%= f.label :content %>
    <%= f.text_field :content %>
  </div>

  <div class="field">
    <%= f.hidden_field :pin_id, :value => @pin.id %>
  </div>

  <div class="actions">
    <%= f.hidden_field :user_id, :value => current_user.id %>
    <%= f.submit %>
  </div>
<% end %>

Add user hidden field to apply user id to new comment
Add user hidden field to apply user id to new comment
