ActiveRecord callbacks: an after_commit gotchya

class MyModel
after_commit :api_call_and_update, on: :create

...
def api_call_and_update
# API call to move resource from temp to proper S3 bucket...
self.update(bucket: 'New bucket')
end
end

--

--

--

Full stack developer (Ruby, JavaScript, React)

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Greg Fisher

Greg Fisher

Full stack developer (Ruby, JavaScript, React)

More from Medium

Self-Joining Tables

For the Record

Introduction to creating a Sinatra and Active Record.

Learning Ruby from scratch -part 01