From 0b46d5c184418145cf39ddf8cabc233673920cd0 Mon Sep 17 00:00:00 2001 From: Abhay Nikam Date: Thu, 3 Jun 2021 00:28:25 +0530 Subject: [PATCH] Document ActiveStorage::Attached::One#blank? [ci skip] --- activestorage/lib/active_storage/attached/one.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/activestorage/lib/active_storage/attached/one.rb b/activestorage/lib/active_storage/attached/one.rb index ab5a671fe5..2ab78b206c 100644 --- a/activestorage/lib/active_storage/attached/one.rb +++ b/activestorage/lib/active_storage/attached/one.rb @@ -13,6 +13,13 @@ module ActiveStorage change.present? ? change.attachment : record.public_send("#{name}_attachment") end + # Returns +true+ if an attachment is not attached. + # + # class User < ApplicationRecord + # has_one_attached :avatar + # end + # + # User.new.avatar.blank? # => true def blank? !attached? end