1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix img alt attribute generation when using Sprockets >= 3.0

This commit is contained in:
Bart de Water 2016-01-27 19:35:37 +01:00
parent 9864bcee8c
commit 5e3a23a307
2 changed files with 6 additions and 1 deletions

View file

@ -1,3 +1,8 @@
* Fix stripping the digest from the automatically generated img tag alt
attribute when assets are handled by Sprockets >=3.0.
*Bart de Water*
* Create a new `ActiveSupport::SafeBuffer` instance when `content_for` is flushed.
Fixes #19890

View file

@ -239,7 +239,7 @@ module ActionView
# image_alt('underscored_file_name.png')
# # => Underscored file name
def image_alt(src)
File.basename(src, '.*'.freeze).sub(/-[[:xdigit:]]{32}\z/, ''.freeze).tr('-_'.freeze, ' '.freeze).capitalize
File.basename(src, '.*'.freeze).sub(/-[[:xdigit:]]{32,64}\z/, ''.freeze).tr('-_'.freeze, ' '.freeze).capitalize
end
# Returns an HTML video tag for the +sources+. If +sources+ is a string,