we use shrine to mostly handle “private” uploads. We never serve files directly by using the “_url” helpers, we only serve them through controllers because we have to authorize the user before loading files.
class SomeController < ApplicationController def show authorize current_user user = User.find params[:id] send_file user.profile_picture.open end end
This works great if the file exists. But if a user does not have a profile picture we want to send a default image. We have defined the default_url in the uploader, but as far as i can tell this only works for the “_url” helpers. “user.profile_picture” will return nil, but “user.profile_picture_url” generates a URL.
What we need is something like “user.profile_picture.open” but for the default_url. Is there a way to solve this with shrine right now?