문제

My code is this

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

but it assign

geo_lat=0

and

geo_long=0

In my database structure default value is null for both and i want to assign null please help me

도움이 되었습니까?

해결책

The issue here are string 'null'.

Try the following:

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

Also check your migration to see if default is not set to string 'null'.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top