diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2018-04-27 14:35:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-27 14:35:21 -0400 |
commit | ad0220a71a2d42191a3acf6118321b504f1ad70c (patch) | |
tree | e93585a7a5c5569ac1a3470986a592bd07cbc1a7 /activestorage/lib/active_storage/attached | |
parent | 1230253153edcccc1316f1ab9bc16684ba02b0ae (diff) | |
parent | 42259ce904eb2538761b32a793cbe390fb8272b7 (diff) | |
download | rails-ad0220a71a2d42191a3acf6118321b504f1ad70c.tar.gz rails-ad0220a71a2d42191a3acf6118321b504f1ad70c.tar.bz2 rails-ad0220a71a2d42191a3acf6118321b504f1ad70c.zip |
Merge pull request #31956 from fatkodima/has_attached-presence-validation
has_(one/many)_attached presence validation
Diffstat (limited to 'activestorage/lib/active_storage/attached')
-rw-r--r-- | activestorage/lib/active_storage/attached/one.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activestorage/lib/active_storage/attached/one.rb b/activestorage/lib/active_storage/attached/one.rb index a582ed0137..f992cb5f84 100644 --- a/activestorage/lib/active_storage/attached/one.rb +++ b/activestorage/lib/active_storage/attached/one.rb @@ -13,6 +13,10 @@ module ActiveStorage record.public_send("#{name}_attachment") end + def blank? + attachment.blank? + end + # Associates a given attachment with the current record, saving it to the database. # # person.avatar.attach(params[:avatar]) # ActionDispatch::Http::UploadedFile object |