title: Rails STI and strong parameters
body: <p>I have a Client resource with 2 types: Person and Company.</p>
  
  <p>routes.rb:</p>
  
  <pre><code>resources :clients
  resources :people, :controller =&gt; "clients", :type =&gt; "Person"
  resources :companies, :controller =&gt; "clients", :type =&gt; "Company"
  </code></pre>
  
  <p>clients_controller:</p>
  
  <pre><code>def new
    @client = Client.new()
    @client.type = params[:type]
  end
  
  def create
    @client = current_partner.clients.new(client_params)
    if @client.save
      redirect_to clients_path
    ...
  end
  
  ...
  private
  def client_params
    params.require(:client).permit(:type, :partner_id, :name, :email, :phone, :cui,   :registration_id, :address)
  end
  
  def find_client
    @client ||= Client.find(params[:id])
  end
  </code></pre>
  
  <p>client.rb</p>
  
  <pre><code>class Client &lt; ActiveRecord::Base
    validates_presence_of :type
    CLIENT_TYPES = ['Person', 'Company']
  end
  </code></pre>
  
  <p>person.rb</p>
  
  <pre><code>class Person &lt; Client
    validates_presence_of :name, :email, :phone
  end
  </code></pre>
  
  <p>compay.rb</p>
  
  <pre><code>class Company &lt; Client
    validates_presence_of :name, :email, :cui, :registration_id, :phone
    validates_uniqueness_of :cui, :registration_id, uniqueness: {scope: :partner_id}
  end
  </code></pre>
  
  <p>The problem is when I'm trying to edit a client's details and I submit the changes, I get 
      param is missing or the value is empty: client.
  The route from where I'm getting this error is .../companies/3.</p>
  
  <p>Any help on this noobie question? Thanks!</p>