wouldn''t it be:
@stagiaire.demandes.create(params[:demande])
On 5/17/06, irong <irong@irong2k.com> wrote:>
> 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 :(
>
> 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
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060518/1b714f77/attachment-0001.html