How to update Watched First Post Categories for all users?

I’ve been looking at this topic as a way of updating the “Watching First Post” field for all the users:

However I can’t work out which model/ column to change. This does not work:

UserOption.update_all(watched_first_post_category_ids: '[5,6,7,8]')

As watched_first_post_category_ids does not exist in the user_options table.

I’ve had a poke around in the Discourse Github code but I’m new to Rails & not sure what I should be looking for.

Could someone please give me the correct Rails Console command to change the “Watching First Post” field for all users?

1 Like

@tshenry can you advise?


I’m on my phone and can’t test but I think just remove the quotes from around the array.

1 Like

This should be what you are looking for :slightly_smiling_face: