Feed 2 tables with one Form

hi all,

i have a form with several datas given by the user : name, adress , tel
etc…
When the user press “create” i call an action called “create_stagiaire”
which create his account but i also want to feed another table named
“demandes” where which i feed with a date given by the user. In my form
this date field is writen like this :
<%= date_select ‘demande’, ‘dr’%>

No problem and here is the action :

def create_stagiaire
@stagiaire = Stagiaire.new(params[:stagiaire])
if @stagiaire.save
@stagiaire.demandes.create(params[:dr])
flash[:notice] = ‘Stagiaire was successfully created.’
redirect_to :action => ‘list’
else
render :action => ‘new’
end

My probleme is that, it creates an entry in the “stagiaires” table with
no problem, but not in the “demandes” table :frowning:

here the error : Mysql::Error: #23000Column ‘dr’ cannot be null: INSERT
INTO demandes (dr, type, stagiaire_id) VALUES(NULL, ‘’, 13)

i supposed that i did something wrong near :
@stagiaire.demandes.create(params[:dr]) thks

wouldn’t it be:

@stagiaire.demandes.create(params[:demande])