Hi,

I'm trying to create forms for child objects that are separate from
the parent objects but that preserve the relation.  I have this as my
controller methods but when I submit the "new" form it says :

Couldn't find Inventory without an ID


Can you please help?


  def new
    @order = @inventory.orders.build
  end


  def create
    @order = Order.new(params[:order])
    @order.inventory_id = params[:inventory_id]

    respond_to do |format|
      if @order.save
        flash[:success] = 'Order created successfully'
        logger.debug " order saved successfully"
        format.html { redirect_to
inventory_path(@order.inventory_id) }
      else
        logger.debug " order not saved"
        format.html { render :action => "new" }
      end
    end

  end

  def get_inventory
    @inventory = Inventory.find(params[:inventory_id])
  end

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to