Date format issue: Empty (NULL) date is getting save in mysql DB

I am having issue while saving date (effective_at) to mysql databse
usning format MM-DD-YY. The date is getting saved as null but while
using format ‘YYYY-MM-DD’ its working perfectly. Please see below.

Processing UsersController#update (for 127.0.0.1 at 2009-07-20
10:35:24) [PUT]
Session ID:
BAh7ByIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo
%0ASGFzaHsABjoKQHVzZWR7ADoMdXNlcl9pZGkI–454ad118c53a4bb341e1cf4af1fabbf5eee6cc4b
Parameters: {“user”=>{“effective_at”=>“07-19-2009”, “status”=>“I”,
“expired_at”=>"", “password_confirmation”=>"", “reset_password”=>“N”,
“id”=>“1”, “first_name”=>“abcsss”, “group”=>“S”,
“last_name”=>“testwwwww”, “password”=>"", “login”=>“quentin”,
“middle_name”=>“wwww”, “email”=>“[email protected]”, “agent_id”=>“001-
AMC-123456”}, “format”=>“xml”, “_method”=>“PUT”, “action”=>“update”,
“id”=>“1”, “controller”=>“users”}
[4;35;1mUser Columns (0.000000) [0m [0mSHOW FIELDS FROM users
[0m
[4;36;1mUser Load (0.015000) [0m [0;1mSELECT * FROM users
WHERE (users.id = 3) LIMIT 1 [0m
[4;35;1mUser Load (0.000000) [0m [0mSELECT * FROM users WHERE
(users.id = 1) [0m
[4;36;1mSQL (0.000000) [0m [0;1mBEGIN [0m
[4;35;1mUser Load (0.000000) [0m [0mSELECT * FROM users WHERE
(LOWER(users.login) = ‘quentin’ AND users.id <> 1) LIMIT 1 [0m
[4;36;1mUser Load (0.000000) [0m [0;1mSELECT * FROM users
WHERE (LOWER(users.email) = ‘[email protected]’ AND users.id <> 1)
LIMIT 1 [0m
[4;35;1mUser Update (0.000000) [0m [0mUPDATE users SET
created_at = ‘2009-01-13 12:17:58’, agent_id = ‘001-AMC-123456’,
login = ‘quentin’, expired_at = NULL, reset_password = ‘N’,
remember_token_expires_at = NULL, status = ‘I’, salt =
‘7e3041ebc2fc05a40c60028e2c4901a81035d3cd’, effective_at =
‘2009-07-21 00:00:00’, middle_name = ‘wwww’, last_name =
‘testwwwww’, group = ‘S’, first_name = ‘abcsss’, remember_token
= NULL, email = ‘[email protected]’, updated_at = ‘2009-07-20
10:35:24’, encrypted_password =
‘d084e486e59a0f8af8cc6a2d730097ba0404b008’ WHERE id = 1 [0m
[4;36;1mSQL (0.000000) [0m [0;1mCOMMIT [0m
WARNING: Can’t mass-assign these protected attributes: id
[4;35;1mSQL (0.000000) [0m [0mBEGIN [0m
[4;36;1mUser Load (0.000000) [0m [0;1mSELECT * FROM users
WHERE (LOWER(users.login) = ‘quentin’ AND users.id <> 1) LIMIT 1 [0m
[4;35;1mUser Load (0.000000) [0m [0mSELECT * FROM users WHERE
(LOWER(users.email) = ‘[email protected]’ AND users.id <> 1) LIMIT 1
[0m
[4;36;1mUser Update (0.000000) [0m [0;1mUPDATE users SET
created_at = ‘2009-01-13 12:17:58’, agent_id = ‘001-AMC-123456’,
login = ‘quentin’, expired_at = NULL, reset_password = ‘N’,
remember_token_expires_at = NULL, status = ‘I’, salt =
‘7e3041ebc2fc05a40c60028e2c4901a81035d3cd’, effective_at = NULL,
middle_name = ‘wwww’, last_name = ‘testwwwww’, group = ‘S’,
first_name = ‘abcsss’, remember_token = NULL, email =
[email protected]’, updated_at = ‘2009-07-20 10:35:24’,
encrypted_password = ‘d084e486e59a0f8af8cc6a2d730097ba0404b008’
WHERE id = 1 [0m
[4;35;1mSQL (0.000000) [0m [0mCOMMIT [0m
Completed in 0.10900 (9 reqs/sec) | Rendering: 0.00000 (0%) | DB:
0.01500 (13%) | 200 OK [http://localhost/users/1.xml]

provide the form that sends data. Then we can find out the cause.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs