The link you provided shows a very similar example of what not to do, which is what you did.
That is, to provide invalid WKT:
record.lonlat = 'POINT(-122, 47)'
Which fails to parse, and silently sets the value to nil. (Valid WKT looks like POINT(-122 47)
).
The link describes a few alternative ways to construct a geometry, such as:
factory.point(-122, 47)