Hillary Hueter
2013-Jan-01 19:30 UTC
Can''t Save a new object even though the request parameters are correct
My form fails with the error Mysql2::Error: Column ''date_of_birth'' cannot be null. However the Request Parameters have a value for date_of_birth, so i''m not sure whats going on. Request: {"utf8"=>"✓", "authenticity_token"=>"3njnNBX4VgoV32kau3OALfhdIP00Bq78we6EKD7OXHo=", "pilgrim"=>{"surname"=>"Lorem", "first"=>"Ipsum", "middle"=>"Lorem", "aka"=>"Lorem", "title"=>"Mrs. ", "address"=>"111 Mockingbird Lane", "city"=>"City", "state"=>"CA", "email"=>"loremipsum-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org", "telephone"=>"889-279-2727", "nationality"=>"USA", "passport_number"=>"123455", "expiration"=>"06-15-2015", "date_of_birth"=>"06-15-1086", "jordan"=>"yes", "room"=>"Share", "leader"=>"Group Leader", "price"=>"4000", "deposit"=>"500", "trip_id"=>"44", "balance"=>"3500"}, "commit"=>"Save"} Here''s a gist with the form and controller code that''s causing the issue. https://gist.github.com/4429457 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/oKhWrEOR_WcJ. For more options, visit https://groups.google.com/groups/opt_out.
Dheeraj Kumar
2013-Jan-02 09:49 UTC
Re: Can''t Save a new object even though the request parameters are correct
What is the executed SQL? Look at your development log. -- Dheeraj Kumar On Wednesday 2 January 2013 at 1:00 AM, Hillary Hueter wrote:> My form fails with the error Mysql2::Error: Column ''date_of_birth'' cannot be null. However the Request Parameters have a value for date_of_birth, so i''m not sure whats going on. > Request: > {"utf8"=>"✓", "authenticity_token"=>"3njnNBX4VgoV32kau3OALfhdIP00Bq78we6EKD7OXHo=", "pilgrim"=>{"surname"=>"Lorem", "first"=>"Ipsum", "middle"=>"Lorem", "aka"=>"Lorem", "title"=>"Mrs. ", "address"=>"111 Mockingbird Lane", "city"=>"City", "state"=>"CA", "email"=>"loremipsum-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org (mailto:loremipsum-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org)", "telephone"=>"889-279-2727", "nationality"=>"USA", "passport_number"=>"123455", "expiration"=>"06-15-2015", "date_of_birth"=>"06-15-1086", "jordan"=>"yes", "room"=>"Share", "leader"=>"Group Leader", "price"=>"4000", "deposit"=>"500", "trip_id"=>"44", "balance"=>"3500"}, > "commit"=>"Save"} > > > Here''s a gist with the form and controller code that''s causing the issue. https://gist.github.com/4429457 > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com (mailto:rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/oKhWrEOR_WcJ. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Rafi A
2013-Jan-02 09:57 UTC
Re: Can''t Save a new object even though the request parameters are correct
On Wed, Jan 2, 2013 at 1:00 AM, Hillary Hueter <weimar1927-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> My form fails with the error Mysql2::Error: Column ''date_of_birth'' cannot > be null. However the Request Parameters have a value for date_of_birth, > so i''m not sure whats going on. > Request: > > > {"utf8"=>"✓", > "authenticity_token"=>"3njnNBX4VgoV32kau3OALfhdIP00Bq78we6EKD7OXHo=", > "pilgrim"=>{"surname"=>"Lorem", > "first"=>"Ipsum", > "middle"=>"Lorem", > "aka"=>"Lorem", > "title"=>"Mrs. ", > "address"=>"111 Mockingbird Lane", > "city"=>"City", > "state"=>"CA", > "email"=>"loremipsum-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org", > "telephone"=>"889-279-2727", > "nationality"=>"USA", > "passport_number"=>"123455", > "expiration"=>"06-15-2015", > "date_of_birth"=>"06-15-1086", > "jordan"=>"yes", > "room"=>"Share", > "leader"=>"Group Leader", > "price"=>"4000", > "deposit"=>"500", > "trip_id"=>"44", > "balance"=>"3500"}, > > "commit"=>"Save"} > > > Here''s a gist with the form and controller code that''s causing the issue. > https://gist.github.com/4429457 > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/oKhWrEOR_WcJ. > For more options, visit https://groups.google.com/groups/opt_out. > > >What is the datatype that you have set for the date_of_birth column? If it''s date-time, then you can try convert the string into Date object first and then store the parsed value in database. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
tamouse mailing lists
2013-Jan-02 16:44 UTC
Re: Can''t Save a new object even though the request parameters are correct
On Wed, Jan 2, 2013 at 3:57 AM, Rafi A <rafiglitz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Wed, Jan 2, 2013 at 1:00 AM, Hillary Hueter <weimar1927-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> My form fails with the error Mysql2::Error: Column ''date_of_birth'' cannot >> be null. However the Request Parameters have a value for date_of_birth, so >> i''m not sure whats going on. >> Request: >> >> {"utf8"=>"✓", >> "authenticity_token"=>"3njnNBX4VgoV32kau3OALfhdIP00Bq78we6EKD7OXHo=", >> "pilgrim"=>{"surname"=>"Lorem", >> "first"=>"Ipsum", >> "middle"=>"Lorem", >> "aka"=>"Lorem", >> "title"=>"Mrs. ", >> "address"=>"111 Mockingbird Lane", >> "city"=>"City", >> "state"=>"CA", >> "email"=>"loremipsum-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org", >> "telephone"=>"889-279-2727", >> "nationality"=>"USA", >> "passport_number"=>"123455", >> "expiration"=>"06-15-2015", >> "date_of_birth"=>"06-15-1086", >> "jordan"=>"yes", >> "room"=>"Share", >> "leader"=>"Group Leader", >> "price"=>"4000", >> "deposit"=>"500", >> "trip_id"=>"44", >> "balance"=>"3500"}, >> >> "commit"=>"Save"} >> >> >> Here''s a gist with the form and controller code that''s causing the issue. >> https://gist.github.com/4429457 >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To view this discussion on the web visit >> https://groups.google.com/d/msg/rubyonrails-talk/-/oKhWrEOR_WcJ. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > What is the datatype that you have set for the date_of_birth column? If it''s > date-time, then you can try convert the string into Date object first and > then store the parsed value in database.Is this valid?>> "date_of_birth"=>"06-15-1086",?? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Hillary Hueter
2013-Jan-03 06:34 UTC
Re: Can''t Save a new object even though the request parameters are correct
It was what i put in. It''s probably not entirely valid, but i haven''t put that type of validation into the form yet. On Wednesday, January 2, 2013 8:44:04 AM UTC-8, tamouse wrote:> > On Wed, Jan 2, 2013 at 3:57 AM, Rafi A <rafi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> > wrote: > > > > > > On Wed, Jan 2, 2013 at 1:00 AM, Hillary Hueter <weima...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org<javascript:>> > wrote: > >> > >> My form fails with the error Mysql2::Error: Column ''date_of_birth'' > cannot > >> be null. However the Request Parameters have a value for date_of_birth, > so > >> i''m not sure whats going on. > >> Request: > >> > >> {"utf8"=>"✓", > >> "authenticity_token"=>"3njnNBX4VgoV32kau3OALfhdIP00Bq78we6EKD7OXHo=", > >> "pilgrim"=>{"surname"=>"Lorem", > >> "first"=>"Ipsum", > >> "middle"=>"Lorem", > >> "aka"=>"Lorem", > >> "title"=>"Mrs. ", > >> "address"=>"111 Mockingbird Lane", > >> "city"=>"City", > >> "state"=>"CA", > >> "email"=>"lorem...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>", > >> "telephone"=>"889-279-2727", > >> "nationality"=>"USA", > >> "passport_number"=>"123455", > >> "expiration"=>"06-15-2015", > >> "date_of_birth"=>"06-15-1086", > >> "jordan"=>"yes", > >> "room"=>"Share", > >> "leader"=>"Group Leader", > >> "price"=>"4000", > >> "deposit"=>"500", > >> "trip_id"=>"44", > >> "balance"=>"3500"}, > >> > >> "commit"=>"Save"} > >> > >> > >> Here''s a gist with the form and controller code that''s causing the > issue. > >> https://gist.github.com/4429457 > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "Ruby on Rails: Talk" group. > >> To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<javascript:>. > > >> To unsubscribe from this group, send email to > >> rubyonrails-ta...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. > >> To view this discussion on the web visit > >> https://groups.google.com/d/msg/rubyonrails-talk/-/oKhWrEOR_WcJ. > >> For more options, visit https://groups.google.com/groups/opt_out. > >> > >> > > > > What is the datatype that you have set for the date_of_birth column? If > it''s > > date-time, then you can try convert the string into Date object first > and > > then store the parsed value in database. > > Is this valid? > > >> "date_of_birth"=>"06-15-1086", > > ?? >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/9PfzYHV5XQQJ. For more options, visit https://groups.google.com/groups/opt_out.
tamouse mailing lists
2013-Jan-03 07:07 UTC
Re: Can''t Save a new object even though the request parameters are correct
On Thu, Jan 3, 2013 at 12:34 AM, Hillary Hueter <weimar1927-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> It was what i put in. It''s probably not entirely valid, but i haven''t put > that type of validation into the form yet. > > On Wednesday, January 2, 2013 8:44:04 AM UTC-8, tamouse wrote: >> >> On Wed, Jan 2, 2013 at 3:57 AM, Rafi A <rafi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > >> > >> > On Wed, Jan 2, 2013 at 1:00 AM, Hillary Hueter <weima...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> > wrote: >> >> >> >> My form fails with the error Mysql2::Error: Column ''date_of_birth'' >> >> cannot >> >> be null. However the Request Parameters have a value for date_of_birth, >> >> so >> >> i''m not sure whats going on. >> >> Request: >> >> >> >> {"utf8"=>"✓", >> >> "authenticity_token"=>"3njnNBX4VgoV32kau3OALfhdIP00Bq78we6EKD7OXHo=", >> >> "pilgrim"=>{"surname"=>"Lorem", >> >> "first"=>"Ipsum", >> >> "middle"=>"Lorem", >> >> "aka"=>"Lorem", >> >> "title"=>"Mrs. ", >> >> "address"=>"111 Mockingbird Lane", >> >> "city"=>"City", >> >> "state"=>"CA", >> >> "email"=>"lorem...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org", >> >> "telephone"=>"889-279-2727", >> >> "nationality"=>"USA", >> >> "passport_number"=>"123455", >> >> "expiration"=>"06-15-2015", >> >> "date_of_birth"=>"06-15-1086", >> >> "jordan"=>"yes", >> >> "room"=>"Share", >> >> "leader"=>"Group Leader", >> >> "price"=>"4000", >> >> "deposit"=>"500", >> >> "trip_id"=>"44", >> >> "balance"=>"3500"}, >> >> >> >> "commit"=>"Save"} >> >> >> >> >> >> Here''s a gist with the form and controller code that''s causing the >> >> issue. >> >> https://gist.github.com/4429457 >> >> >> >> -- >> >> You received this message because you are subscribed to the Google >> >> Groups >> >> "Ruby on Rails: Talk" group. >> >> To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >> To unsubscribe from this group, send email to >> >> rubyonrails-ta...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >> To view this discussion on the web visit >> >> https://groups.google.com/d/msg/rubyonrails-talk/-/oKhWrEOR_WcJ. >> >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> >> >> > >> > What is the datatype that you have set for the date_of_birth column? If >> > it''s >> > date-time, then you can try convert the string into Date object first >> > and >> > then store the parsed value in database. >> >> Is this valid? >> >> >> "date_of_birth"=>"06-15-1086", >> >> ??What shows up in your log? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
tamouse mailing lists
2013-Jan-03 07:29 UTC
Re: Can''t Save a new object even though the request parameters are correct
On Thu, Jan 3, 2013 at 1:07 AM, tamouse mailing lists <tamouse.lists-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Thu, Jan 3, 2013 at 12:34 AM, Hillary Hueter <weimar1927-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> It was what i put in. It''s probably not entirely valid, but i haven''t put >> that type of validation into the form yet. >> >> On Wednesday, January 2, 2013 8:44:04 AM UTC-8, tamouse wrote: >>> >>> On Wed, Jan 2, 2013 at 3:57 AM, Rafi A <rafi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> > >>> > >>> > On Wed, Jan 2, 2013 at 1:00 AM, Hillary Hueter <weima...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>> > wrote: >>> >> >>> >> My form fails with the error Mysql2::Error: Column ''date_of_birth'' >>> >> cannot >>> >> be null. However the Request Parameters have a value for date_of_birth, >>> >> so >>> >> i''m not sure whats going on. >>> >> Request: >>> >> >>> >> {"utf8"=>"✓", >>> >> "authenticity_token"=>"3njnNBX4VgoV32kau3OALfhdIP00Bq78we6EKD7OXHo=", >>> >> "pilgrim"=>{"surname"=>"Lorem", >>> >> "first"=>"Ipsum", >>> >> "middle"=>"Lorem", >>> >> "aka"=>"Lorem", >>> >> "title"=>"Mrs. ", >>> >> "address"=>"111 Mockingbird Lane", >>> >> "city"=>"City", >>> >> "state"=>"CA", >>> >> "email"=>"lorem...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org", >>> >> "telephone"=>"889-279-2727", >>> >> "nationality"=>"USA", >>> >> "passport_number"=>"123455", >>> >> "expiration"=>"06-15-2015", >>> >> "date_of_birth"=>"06-15-1086", >>> >> "jordan"=>"yes", >>> >> "room"=>"Share", >>> >> "leader"=>"Group Leader", >>> >> "price"=>"4000", >>> >> "deposit"=>"500", >>> >> "trip_id"=>"44", >>> >> "balance"=>"3500"}, >>> >> >>> >> "commit"=>"Save"} >>> >> >>> >> >>> >> Here''s a gist with the form and controller code that''s causing the >>> >> issue. >>> >> https://gist.github.com/4429457 >>> >> >>> >> -- >>> >> You received this message because you are subscribed to the Google >>> >> Groups >>> >> "Ruby on Rails: Talk" group. >>> >> To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> >> To unsubscribe from this group, send email to >>> >> rubyonrails-ta...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> >> To view this discussion on the web visit >>> >> https://groups.google.com/d/msg/rubyonrails-talk/-/oKhWrEOR_WcJ. >>> >> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >>> >> >>> > >>> > What is the datatype that you have set for the date_of_birth column? If >>> > it''s >>> > date-time, then you can try convert the string into Date object first >>> > and >>> > then store the parsed value in database. >>> >>> Is this valid? >>> >>> >> "date_of_birth"=>"06-15-1086", >>> >>> ?? > > What shows up in your log?I''m just curious how it works, and how your model is set up. Entering a date value of "06-15-1086" into mysql gives a 0 date. Assuming that''s MM-DD-YYYY, mysql needs YYYY-MM-DD unless you do some other munging. (Plus, I''m curious about a birth year 1000 years ago...) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
weimar
2013-Jan-03 08:06 UTC
Re: Can''t Save a new object even though the request parameters are correct
If i was going to put the date into the correct format, would i do it within the controller or the model? On Wed, Jan 2, 2013 at 11:29 PM, tamouse mailing lists < tamouse.lists-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Thu, Jan 3, 2013 at 1:07 AM, tamouse mailing lists > <tamouse.lists-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > On Thu, Jan 3, 2013 at 12:34 AM, Hillary Hueter <weimar1927-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > >> It was what i put in. It''s probably not entirely valid, but i haven''t > put > >> that type of validation into the form yet. > >> > >> On Wednesday, January 2, 2013 8:44:04 AM UTC-8, tamouse wrote: > >>> > >>> On Wed, Jan 2, 2013 at 3:57 AM, Rafi A <rafi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >>> > > >>> > > >>> > On Wed, Jan 2, 2013 at 1:00 AM, Hillary Hueter <weima...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > >>> > wrote: > >>> >> > >>> >> My form fails with the error Mysql2::Error: Column ''date_of_birth'' > >>> >> cannot > >>> >> be null. However the Request Parameters have a value for > date_of_birth, > >>> >> so > >>> >> i''m not sure whats going on. > >>> >> Request: > >>> >> > >>> >> {"utf8"=>"✓", > >>> >> > "authenticity_token"=>"3njnNBX4VgoV32kau3OALfhdIP00Bq78we6EKD7OXHo=", > >>> >> "pilgrim"=>{"surname"=>"Lorem", > >>> >> "first"=>"Ipsum", > >>> >> "middle"=>"Lorem", > >>> >> "aka"=>"Lorem", > >>> >> "title"=>"Mrs. ", > >>> >> "address"=>"111 Mockingbird Lane", > >>> >> "city"=>"City", > >>> >> "state"=>"CA", > >>> >> "email"=>"lorem...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org", > >>> >> "telephone"=>"889-279-2727", > >>> >> "nationality"=>"USA", > >>> >> "passport_number"=>"123455", > >>> >> "expiration"=>"06-15-2015", > >>> >> "date_of_birth"=>"06-15-1086", > >>> >> "jordan"=>"yes", > >>> >> "room"=>"Share", > >>> >> "leader"=>"Group Leader", > >>> >> "price"=>"4000", > >>> >> "deposit"=>"500", > >>> >> "trip_id"=>"44", > >>> >> "balance"=>"3500"}, > >>> >> > >>> >> "commit"=>"Save"} > >>> >> > >>> >> > >>> >> Here''s a gist with the form and controller code that''s causing the > >>> >> issue. > >>> >> https://gist.github.com/4429457 > >>> >> > >>> >> -- > >>> >> You received this message because you are subscribed to the Google > >>> >> Groups > >>> >> "Ruby on Rails: Talk" group. > >>> >> To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >>> >> To unsubscribe from this group, send email to > >>> >> rubyonrails-ta...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >>> >> To view this discussion on the web visit > >>> >> https://groups.google.com/d/msg/rubyonrails-talk/-/oKhWrEOR_WcJ. > >>> >> For more options, visit https://groups.google.com/groups/opt_out. > >>> >> > >>> >> > >>> > > >>> > What is the datatype that you have set for the date_of_birth column? > If > >>> > it''s > >>> > date-time, then you can try convert the string into Date object first > >>> > and > >>> > then store the parsed value in database. > >>> > >>> Is this valid? > >>> > >>> >> "date_of_birth"=>"06-15-1086", > >>> > >>> ?? > > > > What shows up in your log? > > I''m just curious how it works, and how your model is set up. Entering > a date value of "06-15-1086" into mysql gives a 0 date. Assuming > that''s MM-DD-YYYY, mysql needs YYYY-MM-DD unless you do some other > munging. (Plus, I''m curious about a birth year 1000 years ago...) > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Hillary Hueter
2013-Jan-03 10:22 UTC
Re: Can''t Save a new object even though the request parameters are correct
i think this had something to do with the type of the date_of_birth column. I''ve changed it from datetime to date. and it seems to be working. On Tuesday, January 1, 2013 11:30:50 AM UTC-8, Hillary Hueter wrote:> > My form fails with the error Mysql2::Error: Column ''date_of_birth'' cannot > be null. However the Request Parameters have a value for date_of_birth, > so i''m not sure whats going on. > Request: > > {"utf8"=>"✓", > "authenticity_token"=>"3njnNBX4VgoV32kau3OALfhdIP00Bq78we6EKD7OXHo=", > "pilgrim"=>{"surname"=>"Lorem", > "first"=>"Ipsum", > "middle"=>"Lorem", > "aka"=>"Lorem", > "title"=>"Mrs. ", > "address"=>"111 Mockingbird Lane", > "city"=>"City", > "state"=>"CA", > "email"=>"loremipsum-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org", > "telephone"=>"889-279-2727", > "nationality"=>"USA", > "passport_number"=>"123455", > "expiration"=>"06-15-2015", > "date_of_birth"=>"06-15-1086", > "jordan"=>"yes", > "room"=>"Share", > "leader"=>"Group Leader", > "price"=>"4000", > "deposit"=>"500", > "trip_id"=>"44", > "balance"=>"3500"}, > > "commit"=>"Save"} > > > Here''s a gist with the form and controller code that''s causing the issue. > https://gist.github.com/4429457 >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/qDj9j3n4U00J. For more options, visit https://groups.google.com/groups/opt_out.
tamouse mailing lists
2013-Jan-04 03:24 UTC
Re: Can''t Save a new object even though the request parameters are correct
On Thu, Jan 3, 2013 at 2:06 AM, weimar <weimar1927-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If i was going to put the date into the correct format, would i do it within > the controller or the model?If you consider that a valid form of date (which it is), then doing the manipulation to make it work in the model should go in the model, notably using a before_save hook. OTOH, if you accept any sort of string in that field, you will probably need to validate it''s contents before passing it off to the model, and that should go in the controller. OTOOH, put it where it makes the most sense to you. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
weimar
2013-Jan-04 07:04 UTC
Re: Can''t Save a new object even though the request parameters are correct
ok. thanks. On Thu, Jan 3, 2013 at 7:24 PM, tamouse mailing lists < tamouse.lists-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Thu, Jan 3, 2013 at 2:06 AM, weimar <weimar1927-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > If i was going to put the date into the correct format, would i do it > within > > the controller or the model? > > If you consider that a valid form of date (which it is), then doing > the manipulation to make it work in the model should go in the model, > notably using a before_save hook. > > OTOH, if you accept any sort of string in that field, you will > probably need to validate it''s contents before passing it off to the > model, and that should go in the controller. > > OTOOH, put it where it makes the most sense to you. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.