Hi Rail0rs ;) ive encountered a Problem with date_select and updating a Record. Everything works fine for the Output even the Pre-Selection does its job. But when i do a normal: model.update_attributes(@params["model"]) ... nothing happens to the Datefield. The SQL-Statement logged in the Development Logfile says "NULL" as value for the Field. I proofed my code by reviewing the Tutorial (http://wiki.rubyonrails.com/rails/show/HowtoUseDateHelpers) but my Code isnt working after all :( So where is the problem? I also searched the Trac for something similar but didnt find anything which fits to my Issue. Thanks a lot .b
Can you print out the contents of the parameter? It should even me in the logfile. It might simply be that the parameter name isn''t matching the objects date field... sam On 5/3/05, Björn <bjoern-TFyySJyCJcUbwZ3undymew@public.gmane.org> wrote:> Hi Rail0rs ;) > > ive encountered a Problem with date_select and updating a Record. > Everything works fine for the Output even the Pre-Selection does its > job. But when i do a normal: > > model.update_attributes(@params["model"]) > > ... nothing happens to the Datefield. The SQL-Statement logged in the > Development Logfile says "NULL" as value for the Field. I proofed my > code by reviewing the Tutorial > (http://wiki.rubyonrails.com/rails/show/HowtoUseDateHelpers) but my > Code isnt working after all :( > > So where is the problem? I also searched the Trac for something similar > but didnt find anything which fits to my Issue. > > Thanks a lot > .b > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- sam http://www.magpiebrain.com/
The pre-selection works as expected so the parameter name should be correct. The only thing whats strange are the selectboxes generated by date_select helper: <select name="model[birthday(1i)]">...</select> <select name="model[birthday(2i)]">...</select> <select name="model[birthday(3i)]">...</select> The tutorial mentions that this syntax is correct and Rails will use this information for putting the fields together before doing the database-thing. So either Rails is buggy or the Tutorial is misunderstanding. Am 03.05.2005 um 17:30 schrieb Sam Newman:> Can you print out the contents of the parameter? It should even me in > the logfile. It might simply be that the parameter name isn''t matching > the objects date field... > > sam > > On 5/3/05, Björn <bjoern-TFyySJyCJcUbwZ3undymew@public.gmane.org> wrote: >> Hi Rail0rs ;) >> >> ive encountered a Problem with date_select and updating a Record. >> Everything works fine for the Output even the Pre-Selection does its >> job. But when i do a normal: >> >> model.update_attributes(@params["model"]) >> >> ... nothing happens to the Datefield. The SQL-Statement logged in the >> Development Logfile says "NULL" as value for the Field. I proofed my >> code by reviewing the Tutorial >> (http://wiki.rubyonrails.com/rails/show/HowtoUseDateHelpers) but my >> Code isnt working after all :( >> >> So where is the problem? I also searched the Trac for something >> similar >> but didnt find anything which fits to my Issue. >> >> Thanks a lot >> .b >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > > -- > sam > http://www.magpiebrain.com/ > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Can you also supply the sql query and paramaters coming in on the request from the development log? your update method if you aren''t using scaffolding for it would help as well... Björn wrote:> The pre-selection works as expected so the parameter name should be > correct. The only thing whats strange are the selectboxes generated by > date_select helper: > > <select name="model[birthday(1i)]">...</select> > <select name="model[birthday(2i)]">...</select> > <select name="model[birthday(3i)]">...</select> > > The tutorial mentions that this syntax is correct and Rails will use > this information for putting the fields together before doing the > database-thing. > > So either Rails is buggy or the Tutorial is misunderstanding. > > > Am 03.05.2005 um 17:30 schrieb Sam Newman: > >> Can you print out the contents of the parameter? It should even me in >> the logfile. It might simply be that the parameter name isn''t matching >> the objects date field... >> >> sam >> >> On 5/3/05, Björn <bjoern-TFyySJyCJcUbwZ3undymew@public.gmane.org> wrote: >> >>> Hi Rail0rs ;) >>> >>> ive encountered a Problem with date_select and updating a Record. >>> Everything works fine for the Output even the Pre-Selection does its >>> job. But when i do a normal: >>> >>> model.update_attributes(@params["model"]) >>> >>> ... nothing happens to the Datefield. The SQL-Statement logged in the >>> Development Logfile says "NULL" as value for the Field. I proofed my >>> code by reviewing the Tutorial >>> (http://wiki.rubyonrails.com/rails/show/HowtoUseDateHelpers) but my >>> Code isnt working after all :( >>> >>> So where is the problem? I also searched the Trac for something similar >>> but didnt find anything which fits to my Issue. >>> >>> Thanks a lot >>> .b >>> >>> _______________________________________________ >>> Rails mailing list >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >>> >> >> >> -- >> sam >> http://www.magpiebrain.com/ >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails