Skip to content

Instantly share code, notes, and snippets.

Avatar

Yuval Kordov uberllama

View GitHub Profile
@uberllama
uberllama / gist:6977242
Last active Dec 25, 2015 — forked from littleblimp/gist:5871219
Modified DelayedJob workflow to use the Document's ID rather than serializing the entire Document object.
View gist:6977242
class Document < ActiveRecord::Base
# Environment-specific direct upload url verifier screens for malicious posted upload locations.
DIRECT_UPLOAD_URL_FORMAT = %r{\Ahttps:\/\/s3\.amazonaws\.com\/myapp#{!Rails.env.production? ? "\\-#{Rails.env}" : ''}\/(?<path>uploads\/.+\/(?<filename>.+))\z}.freeze
belongs_to :user
has_attached_file :upload
validates :direct_upload_url, presence: true, format: { with: DIRECT_UPLOAD_URL_FORMAT }
You can’t perform that action at this time.