How to rebake Bios

(Jay Pfaffman) #1

I’ve written an importer that pulls in a database of email addresses and Bios and sticks the bio into the About (aka bio_raw) field. It works fine, but the bios don’t show up because they aren’t getting baked. Inquiring minds want to know:

  • Will a posts:rebake rebake them?
  • Is there a way to rebake just the bios (and not 230K posts)?
  • Is there a way to trigger the rebake in the importer script?
  • If I’m patient will sidekiq notice?
  • Is there a question I should have asked other than these?

(Rafael dos Santos Silva) #2

Something like:

users = UserProfile.where.not(bio_raw: nil)
users.each do |profile|

(Jay Pfaffman) #3

Thanks, @Falco. That’s the ticket!

Is there reason not to add


to my import script after

u.user_profile_update_column('bio_raw', the_imported_bio)


update_column updates the column without calling, which makes me wonder about, but there are lots of things I don’t understand yet. :slight_smile:

(Rafael dos Santos Silva) #4

From a brief read, save would cook for you.

In a import script I believe there’s a lot of concurrent work filling all your CPU cycles, so I would postpone something like bio to the final part.

(Jay Pfaffman) #5

Thanks for RTFMing the code for me. I still have trouble finding the code, but I’m getting there. :slight_smile:

I think I see why to postpone the save. This script imports only bios, though, so I think in this case it’s probably fine to just stick it in this loop.