aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/app
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2017-08-05 09:11:02 -0500
committerGitHub <noreply@github.com>2017-08-05 09:11:02 -0500
commit616f3611d525b97c5cdb1a5feee25621cca27daf (patch)
tree79591ed29b2a9670519438bce2d53f1a096cee06 /activestorage/app
parentbb7599a6c84aba44cbb5f21486ffdb4a549717dd (diff)
parent6df24c693ed50a66feaf116c90df7eba5acf4033 (diff)
downloadrails-616f3611d525b97c5cdb1a5feee25621cca27daf.tar.gz
rails-616f3611d525b97c5cdb1a5feee25621cca27daf.tar.bz2
rails-616f3611d525b97c5cdb1a5feee25621cca27daf.zip
Merge branch 'master' into ast-module
Diffstat (limited to 'activestorage/app')
-rw-r--r--activestorage/app/models/active_storage/blob.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activestorage/app/models/active_storage/blob.rb b/activestorage/app/models/active_storage/blob.rb
index debc62bd41..c72073f9f6 100644
--- a/activestorage/app/models/active_storage/blob.rb
+++ b/activestorage/app/models/active_storage/blob.rb
@@ -80,22 +80,22 @@ class ActiveStorage::Blob < ActiveRecord::Base
# Returns true if the content_type of this blob is in the image range, like image/png.
def image?
- content_type =~ /^image/
+ content_type.start_with?("image")
end
# Returns true if the content_type of this blob is in the audio range, like audio/mpeg.
def audio?
- content_type =~ /^audio/
+ content_type.start_with?("audio")
end
# Returns true if the content_type of this blob is in the video range, like video/mp4.
def video?
- content_type =~ /^video/
+ content_type.start_with?("video")
end
# Returns true if the content_type of this blob is in the text range, like text/plain.
def text?
- content_type =~ /^text/
+ content_type.start_with?("text")
end
# Returns a `ActiveStorage::Variant` instance with the set of `transformations` passed in. This is only relevant