Created
September 4, 2019 20:21
-
-
Save Eth3rnit3/aabf927d45e7973182374f47f7244e1f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment