-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #160 from EleoXDA/3lbay
fix event photo in Heroku
- Loading branch information
Showing
2 changed files
with
9 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
require "open-uri" | ||
|
||
class Event < ApplicationRecord | ||
after_create :set_default_event_avatar | ||
# after_create :set_default_event_avatar | ||
has_one_attached :photo | ||
|
||
def set_default_event_avatar | ||
return if photo.attached? | ||
# def set_default_event_avatar | ||
# return if photo.attached? | ||
|
||
path = "https://res.cloudinary.com/dp6zhyocx/image/upload/v1662046666/pqwya0pvqts4ubv0eqi6.jpg" | ||
file = URI.open(path) | ||
photo.attach(io: file, filename: "userphoto.png", content_type: "image/png") | ||
save | ||
end | ||
# path = "https://res.cloudinary.com/dp6zhyocx/image/upload/v1662046666/pqwya0pvqts4ubv0eqi6.jpg" | ||
# file = URI.open(path) | ||
# photo.attach(io: file, filename: "userphoto.png", content_type: "image/png") | ||
# save | ||
# end | ||
end |
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