title: Rails Form, save nested_attributes with belongs_to association
body: <p>I'm having some troubles saving nested attributes with a <code>belongs_to</code> association.</p>
  
  <p>I have a form to pass a new Order. In it I would like the <code>Customer</code> to confirm some of his infos. I'm able to display the current customer infos but am unable to save new ones.</p>
  
  <p>For info I'm already building the form from the <code>current_customer</code>, the new order is saved for the <code>Customer</code> no probs. What I want is to update <code>Customers</code> info within the form for <code>Order</code></p>
  
  <p>Here is my app:</p>
  
  <p><code>#Order Model</code></p>
  
  <pre><code>belongs_to :customer, inverse_of: :orders, validate: false
  accepts_nested_attributes_for :customer
  </code></pre>
  
  <p><code>#Customer Model</code></p>
  
  <pre><code>has_many :orders, inverse_of: :customer, dependent: :destroy
  accepts_nested_attributes_for :orders
  </code></pre>
  
  <p><code>#Order View new</code></p>
  
  <pre><code>= simple_form_for @order, validate: true do |f|
      = f.association :customer do |c|
          = c.input :phone
  
          = c.input :mobile
  
          = c.input :skype
  </code></pre>
  
  <p><code>#Order controller &gt; #Strong parameters</code></p>
  
  <pre><code>customer_attributes: [
    :id, :phone, :mobile, :skype
  ]
  </code></pre>
  
  <p><code>#Order controller</code></p>
  
  <pre><code>  def new
      @order = current_customer.orders.build
      render 'customers/orders/new'
    end
  
    def create
      @order = current_customer.orders.build order_params
      if @order.save
        flash[:notice] = t('order.create.flash.success')
        redirect_to customers_path
      else
        render 'customers/orders/new'
      end
     end
  </code></pre>
  
  <p><code>#Order model &gt; Validation</code></p>
  
  <p>This is a custom validation, since we ask the <code>Customer</code> to only confirm the field he choose.</p>
  
  <pre><code>%i(phone mobile skype).each do |kind|
        validate "#{kind}_validable".to_sym, if: "call_kind_#{kind}?".to_sym
  
        define_method "#{kind}_validable" do
          return unless !customer.nil? &amp;&amp; customer.send(kind).blank?
          errors.add "customer.#{kind}".to_sym, I18n.t("activerecord.errors.models.customer.attributes.#{kind}.blank")
        end
      end
  
  
  enumerize :call_kind,
                in: { phone: 0, mobile: 1, skype: 2 },
                predicates: { prefix: true },
                default: :mobile
  </code></pre>
  
  <p>Thanks for reading.</p>
  
  <p><strong>My project:</strong></p>
  
  <ul>
  <li>Ruby On Rails 4.2.6 / Ruby 2.2.2</li>
  <li>Devise 3.5.9</li>
  <li>Simple form 3.1.0</li>
  <li>Enumerize 1.1.0</li>
  </ul>