Pergunta

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

Foi útil?

Solução

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'.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top