Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
class MyModel < ActiveRecord::Base
# Paperclip saves its attachments after_save. after_create fires before
# after_save, so we need to fake an after_create after paperclip's
# after_save
has_attached_file :some_s3_stuff
before_create :set_as_being_created
after_save :run_through_zencoder
attr_accessor :last_response
def set_as_being_created
@being_created = true
end
def run_through_zencoder
if @being_created
begin
@last_response = Zencoder::Job.create
if @last_response.success?
@being_created = false
true
else
@being_created = false
raise ActiveRecord::Rollback
end
rescue Zencoder::HTTPError
@being_created = false
raise ActiveRecord::Rollback
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.