title: I cant add order to a customer
body: <p>I am working on a order management system where a user can add a order to a customer. So far so good i can add a customer, edit existing orders and delete existing customers. I can add a order to a customer trough ruby console but not via web. I hope someone can help me out here. </p>
  
  <p><strong>This is the error message i get Webversion</strong> </p>
  
  <pre><code>&gt; &gt; ActiveRecord::RecordNotFound in OrdersController#create Couldn't find Customer with 'id'=
  &gt; 
  &gt; Extracted source (around line #13): 11 12 13 14 15 16
  &gt;               
  &gt; 
  &gt;     def create
  &gt;       @customer = Customer.find params[:customer_id]
  &gt;       @order = @customer.orders.new(params[:order]) 
  &gt;       @order.save    end
  &gt; 
  &gt; Rails.root: /Users/cecil/Desktop/order_management_systeem
  &gt; 
  &gt; Application Trace | Framework Trace | Full Trace
  &gt; app/controllers/orders_controller.rb:13:in `create' Request
  &gt; 
  &gt; Parameters:
  &gt; 
  &gt; {"utf8"=&gt;"✓", 
  &gt; "authenticity_token"=&gt;"IB2vucl9bjhgPtSFaXo9BSSFSmE0WtClIOKKBo2H9PPz45v6nz8YWciwbVRMGoVnrgX/oNaZn84QONel4rpOcw==",
  &gt; "order"=&gt;{"customer_id"=&gt;"13",  "order"=&gt;"sdfada", 
  &gt; "verstuurt"=&gt;"false"},  "commit"=&gt;"create"}
  </code></pre>
  
  <p><strong>Error message Server version</strong></p>
  
  <pre><code>Started POST "/orders" for ::1 at 2015-11-30 11:43:05 +0100
  Processing by OrdersController#create as HTML
    Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"xZp71jR+ZJhvsO8qweF2v3MUBNisG7iGrHVXd1D79VMWZE+VYjwS+cc+Vvvkgc7d+ZSxGU7Y9+2crwrUP8ZP0w==", "order"=&gt;{"customer_id"=&gt;"16", "order"=&gt;"Haha", "verstuurt"=&gt;"false"}, "commit"=&gt;"create"}
    Customer Load (0.1ms)  SELECT  "customers".* FROM "customers" WHERE "customers"."id" = ? LIMIT 1  [["id", nil]]
  Completed 404 Not Found in 1ms (ActiveRecord: 0.1ms)
  
  ActiveRecord::RecordNotFound (Couldn't find Customer with 'id'=):
    app/controllers/orders_controller.rb:13:in `create'
  </code></pre>
  
  <p><strong>My Orders controller</strong> </p>
  
  <pre><code>class OrdersController &lt; ApplicationController
    def index
       @order = Order.find(params[:customer_id])
    end
  
    def new
        @customer = Customer.find params[:customer_id]
        @order = @customer.orders.new
     end
  
  
      def create
        @customer = Customer.find(params[:customer_id])
        @order = @customer.orders.new(params[:order]) 
        @order.save
     end
  
    end
  
    def show
     @order = Order.find(params[:customer_id]) 
    end
  
    def edit
       @customer = Customer.find(params[:customer_id])
    end
  
      def update
      #Find a exisiting object using form paramters
       @order = Order.find(params[:id])
      if @order.update_attributes(order_params)
  
      #if Update succeeds, redirect to the index action
      flash[:notice] = "Subject updated successfully"
      redirect_to(:action =&gt; 'show', :id =&gt; @order.id)
      else
      #If save fails, redisplay the form so user can fix problems
      render('edit') #het zit in de new.html template
      end
    end
  
    def delete
    end
  
    private
    def order_params
      params.require(:order).permit(:customer_id, :pakket, :verstuurt)
    end
  </code></pre>
  
  <p><strong>My order model</strong></p>
  
  <pre><code>&gt; class Order &lt; ActiveRecord::Base      belongs_to :customers
  &gt; 
  &gt;   scope :visible, lambda { where(:visible =&gt; true) }  scope :invisible,
  &gt; lambda { where(:visible =&gt; false) }   scope :sorted, lambda {
  &gt; sorted("orders") }    scope :newest_first, lambda {
  &gt; order("orders.created_at DESC")}  scope :search, lambda {|query|
  &gt;       where(["name LIKE ?", "%#{query}%"])}  end
  </code></pre>
  
  <p><strong>My order form</strong></p>
  
  <pre><code>&lt;%= form_for @order do |f| %&gt;   &lt;table summary="subject form fields"&gt;
      &lt;%= f.hidden_field :customer_id , :value=&gt;params[:customer_id] %&gt;
      &lt;tr&gt;
        &lt;th&gt;Package&lt;/th&gt;
        &lt;td&gt;&lt;%= f.text_field(:order) %&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;th&gt;Sent&lt;/th&gt;
        &lt;td&gt;&lt;%= f.text_field(:verstuurt) %&gt;&lt;/td&gt;
      &lt;/tr&gt;   &lt;/table&gt;
  
    &lt;div class="form-buttons"&gt;
      &lt;%= f.submit "create" %&gt;    &lt;/div&gt; &lt;% end %&gt;
  </code></pre>
  
  <p><strong>My routing</strong></p>
  
  <pre><code>Rails.application.routes.draw do
  
    resources :orders do
    resources :customers
    end
  
  
    get ':controller/:action/:id/:customer_id'
    get ':controller/:action/:id/:customer_id'
  
  
    get 'customers/index'
  
    get 'customers/new'
  
    get 'customers/show'
  
    get 'customers/edit'
  
    get 'customers/delete'
  
    match ':controller(/:action(/:id))', :via =&gt; [:get, :post]
  
    get 'orders/index'
  
    get 'orders/new'
  
  
    get 'orders/show'
  
    get 'orders/edit'
  
    get 'orders/delete'
  </code></pre>