Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Upload < ApplicationRecord
- has_one_attached :file
- after_create :build_url
- private
- def build_url
- update_column(:url, Rails.application.routes.url_helpers.rails_blob_path(file, only_path: true)) if file.attached?
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement