Skip to content

Commit d680850

Browse files
fix lat/lng verification
use lat_valid and lng_valid for is_valid_float? return value. then use lat and lng as the values of p[:lat] and p[:lng]
1 parent 756d951 commit d680850

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/controllers/api/v1/hike_events_controller.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,11 @@ def safe_params (p)
112112
return
113113
end
114114

115-
lat = StrUtil::is_valid_float?(p[:lat])
116-
lng = StrUtil::is_valid_float?(p[:lng])
115+
lat_valid = StrUtil::is_valid_float?(p[:lat])
116+
lng_valid = StrUtil::is_valid_float?(p[:lng])
117+
118+
lat = p[:lat]
119+
lng = p[:lng]
117120

118121
if !lat || !lng
119122
render json: { error: 'Invalid \'lat\' and \'lng\' params. They failed to parse as floating point numbers' }, status: 400 and return

0 commit comments

Comments
 (0)