I want to display a default avatar image if someone has not added a photo. I'm assuming I need to either do a custom getter in the model or a helper.
If I did the getter would it look something like this:
def avatar_url
"default_url" unless self.avatar
end
Use the read_attribute method to detect the presence.
def avatar
read_attribute("avatar") || default_avatar
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With