I can’t find a TopicCustomField this instant (but I told you where to look! :wink)
Here’s this:
[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>
So something like
tcf=TopicCustomField.where(name: 'fun_level', value: 'super-duper-fun')
Then you can get the topic_id and such from tcf (it’s an array of all matches). If you know the topic_id you could do a TopicCustomField.find_by(<all three things to make it unique>).