Migrating my Extension

What’s the secret to creating a migration for my extension that changes
the data yet doesn’t trigger the UserActionObserver?

I already figured out that I need to set MyClass.record_timestamps =
false so that I don’t artificially change the updated_at field, but
changing a value and saving that record still causes the updated_by
field to loose the user_id since migrations don’t have any user
assigned.

What am I missing?

-Chris

If it’s something that can be updated wholesale (i.e. the same for every
record, or derived on the same attributes), you can use
MyClass.update_all, which will not cause them to be loaded with
ActiveRecord.

Sean

It can’t - it’s a calculation based on each record. I just don’t want
to clobber people’s data.

I’m looking into an alternate approach right now so I may get around the
need altogether. Still, it seems like something AR would allow during a
migrate…

-Chris

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs