2013-04-16 3 views
-1

내 코드는이업데이트 데이터는 MySQL의

Profile.update_all(["is_active = ?, name = ?, geo_lat = ?, geo_long = ?, radius = ?, search_option = ?", 1, params[:profile_name],'null','null','null','st']) 

이지만

geo_lat = 0

geo_long = 0

를 할당 내 데이터베이스 구조 기본값에서

모두 에 대한 null로, 나는 나

+0

은 "????? = is_active = 이름 = geo_lat = geo_long = 반경 = search_option?"이 'Profile.update_all를 ([시도 1 PARAMS [: PROFILE_NAME]을 전무, 전무 , nil, 'st'])' – benchwarmer

+0

감사합니다. –

답변

1

여기서 문제는 문자열 '널'입니다 도와주세요 null을 할당 할.

는 다음을 시도해보십시오

Profile.update_all(["is_active = ?, name = ?, geo_lat = ?, geo_long = ?, radius = ?, search_option = ?", 1, params[:profile_name], nil, nil, nil, 'st']) 

또한 기본은 문자열 '널'로 설정되지 않은 경우 확인하려면 마이그레이션을 확인합니다.