RoR初心者です。役割が割り当てられた新しい従業員を作成できません。以下のサーバーログから、「role_ids」が空白であるためレコードが保存されていないことがわかりましたが、「role」の代わりに「role_ids」が渡される理由を理解できません
これはおそらく1行の修正だと思います。問題を理解するのを手伝ってください。お時間をいただきありがとうございます。
Processing by EmployeesController#create as HTML
 Parameters: {"utf8"=>"✓", "authenticity_token"=>"Nf9Ti9vdr0ErvJV3LKoErT6dMoUwWAI5eJVBOUISZxo=", "employee"=> {"name"=>"dvxzv", "role_ids"=>["", "4"], "reports_to"=>"Adam"}, "commit"=>"Create Employee"}
 (0.1ms)  begin transaction
 (0.0ms)  rollback transaction
 Role Load (0.2ms)  SELECT "roles".* FROM "roles" ORDER BY title
 Role Load (0.1ms)  SELECT "roles".* FROM "roles" 
 Rendered employees/_form.html.erb (8.9ms)
上記の行の「role_ids」に注意してください。「role」属性の代わりに role_ids が使用される理由がわかりません
Employee.rb
class Employee < ActiveRecord::Base
attr_accessible :name, :role, :reports_to, :role_ids
validates :name, :presence => true, :length => { :maximum => 20 }
belongs_to :company
has_and_belongs_to_many :roles
end
Role.rb
class Role < ActiveRecord::Base
    attr_accessible :title  
     has_and_belongs_to_many :employees
end
employees_controller.rb
def create
    @employee = User.new(params[:user])
    @role = @employee.roles.build(params[:role]) unless @user.roles.build(params[:role]).blank? 
    respond_to do |format|
      if @employee.save
        format.html { redirect_to @employee, notice: 'Employee was successfully created.' }
        format.json { render json: @employee, status: :created, location: @employee }
      else
        format.html { render action: "new" }
        format.json { render json: @employee.errors, status: :unprocessable_entity }
      end
    end
  end
_form.html.erb
    <%= simple_form_for(@employee, :html => {:class => 'form-horizontal' }) do |f| %>
<fieldset>
    <legend><%= controller.action_name.capitalize %> Employee</legend>  
 <div class="control-group">
 <%= f.label :name, :class => 'control-label' %>
 <div class="controls">
 <%= f.input :name, :label => false %>
  </div>
</div>
<div class="control-group">
 <%= f.label :role, :class => 'control-label' %>
<div class="controls">
 <%= f.association :roles, :collection => Role.all(:order => 'title'), :label_method => :id, :prompt => "Assign role", :label => false %>
    </div>
  </div>
<div class="control-group">
 <%= f.label :reports_to, :class => 'control-label' %>
<div class="controls">
  <%= f.input :reports_to, :collection => [ "Sam", "Adam", "Smith"], :prompt => "Select supervisor", :label => false %>
  </div>
  </div>
  <div class="form-actions">  
<%= f.button :submit %>
</div>
 </fieldset>
<% end %>