Updating post content programmatically

(Thomas Wilson) #1

I am attempting to programmatically change the body of text in a number of posts to include some recently migrated data.

I am moving over our old media centre, which requires adding downloads/attachments to several thousand topics. I have added the relevant rows to uploads and post_uploads - all that’s left to do is to modify each associated post to include the links.

Is it simply a case of updating the ‘raw’ field in posts, or are there more steps required? I have tried doing this with a single topic, but do not see anything updated (possibly cached by redis?).

Should I be using the rails console for this? If so, what are the commands I should be using? Any pointers would be appreciated.


(Jeff Atwood) #2

If you are modifying raw you will need to rebake all posts after doing so.

(Thomas Wilson) #3

Thanks - that worked!