title: cocoon, nested can't create and remove
body: <p>In Rails 4 I want to create an order including product in a devise seller, I use gem "cocoon"</p>
  
  <pre><code>class Seller &lt; ActiveRecord::Base
  has_many :orders
  
  class Order &lt; ActiveRecord::Base
  belongs_to :seller
  has_many :products
  accepts_nested_attributes_for :products, allow_destroy: true
  
  class Product &lt; ActiveRecord::Base
  belongs_to :order
  </code></pre>
  
  <p>and I want to create in new.html but the seller don't need to sign in, I hope it can via URL</p>
  
  <pre><code> new.html
  &lt;%- model_class = Order -%&gt;   
  &lt;%= simple_form_for @order, :html =&gt; { :class =&gt; 'form-horizontal' } do |f| %&gt; 
  &lt;%= f.simple_fields_for :products do |product| %&gt;
  &lt;%= render 'product_fields', :f =&gt; product %&gt;
  &lt;% end %&gt;
  &lt;%= link_to_add_association 'add product', f, :products %&gt;
  &lt;%= f.button :submit, :class =&gt; 'btn-primary' %&gt;
  &lt;% end %&gt;
  
  in product_fields
  
  &lt;%= f.input :name %&gt;
  &lt;%= f.input :description %&gt;
  &lt;%= link_to_remove_association 'remove product', f %&gt;
  
  def new
   current_seller = Seller.find{|person|person.store==params[:store]}
   @order = current_seller.orders.new
  end
  
  def create
  @seller = current_seller
  @order = @seller.orders.new(order_create_params)
  
  respond_to do |format|
    if @order.save
      format.html { redirect_to @order, notice: 'Order was successfully created.' }
      format.json { render action: 'show', status: :created, location: @order }
    else
      format.html { render action: 'new' }
      format.json { render json: @order.errors, status: :unprocessable_entity }
    end
  end
  </code></pre>
  
  <p>end
  the URL like /orders/new?store=test03</p>
  
  <pre><code>def order_create_params
    params.require(:order).permit(products_attributes: [:id, :name, :description, :_destroy]).merge(:seller_id =&gt; @seller.id)
  end
  </code></pre>
  
  <p>I tried a lots way to build but now "remove product" didn't work and If I use Order.new to create only the first one product can save in order(which displays in the beginning) and can't get seller_id and now will cause undefined method `orders' for nil:NilClass when I create</p>
  
  <p>how can I def my create actioin to create order can link seller and add remove product can work</p>