No puedo encontrar un TopicCustomField en este momento (¡pero te dije dónde buscar! :wink)
Aquí está esto:
[4] pry(main)> CategoryCustomField.last
=> #<CategoryCustomField:0x000055be74a00bd0
id: 2,
category_id: 8,
name: "enable_accepted_answers",
value: "true",
created_at: Mon, 26 Apr 2021 15:45:07.862617000 UTC +00:00,
updated_at: Mon, 26 Apr 2021 15:45:07.862617000 UTC +00:00>
Así que algo como:
tcf=TopicCustomField.where(name: 'fun_level', value: 'super-duper-fun')
Luego puedes obtener el topic_id y demás desde tcf (es un array de todas las coincidencias). Si conoces el topic_id, podrías hacer un TopicCustomField.find_by(<los tres elementos para hacerlo único>).