11175
(-- --)
August 14, 2008, 6:00pm
1
Hey guys,
some funny stuff is going on.
image_tag 'items/1.png' # => <IMG alt="1" src="/images/items/1.png." />
<-- Note the . (DOT) !
image_tag 'items/1.jpg' # => <IMG alt="1" src="/images/items/1.jpg" />
<-- no Dot
Does anyone have an idea whats going on here?
Uuuuhhmm... Help please
Cheers,
Stefan
11175
(-- --)
August 14, 2008, 6:09pm
3
As it seems the dot is only added to files that physically exist.
Maybe you overloaded image_tag method somewhere in your helpers?
11175
(-- --)
August 15, 2008, 12:16pm
6
Ryan Bigg wrote:
Version of rails?
2.1.0
So I just set up an empty project again. With only one controller.
Tested it on IIS with FastCGI, Webrick and Mongrel
<%= image_tag "rails.png" %>
#=> <img alt="Rails" src="/images/rails.png.?1218802201" />
Setting ENV["RAILS_ASSET_ID"] = '' produces
#=> <img alt="Rails" src="/images/rails.png." />
Its giving me a real headache
Ryan Bigg wrote:
Version of rails?
Well the guilty line is
source += ".#{ext}" if ext && File.extname(source).blank? ||
File.exist?(File.join(ASSETS_DIR, dir, "#{source}.#{ext}"))
(asset_tag_helper.rb line 489; in this particular case ext will be nil
and source will be foo.png, dir will be images)
Fred
11175
(-- --)
August 15, 2008, 12:44pm
8
Frederick Cheung wrote:
Ryan Bigg wrote:
Version of rails?
Well the guilty line is
source += ".#{ext}" if ext && File.extname(source).blank? ||
File.exist?(File.join(ASSETS_DIR, dir, "#{source}.#{ext}"))
(asset_tag_helper.rb line 489; in this particular case ext will be nil
and source will be foo.png, dir will be images)
Fred
Seems to me like a bug in Ruby. See:
File.exist?(File.join(RAILS_ROOT,'public/images/','rails.png'))
=> true
File.exist?(File.join(RAILS_ROOT,'public/images/','rails.png.'))
=> true
File.exist?(File.join(RAILS_ROOT,'public/images/','rails.pngoops'))
=> false
Frederick Cheung wrote:
Ryan Bigg wrote:
Version of rails?
Well the guilty line is
source += ".#{ext}" if ext && File.extname(source).blank? ||
File.exist?(File.join(ASSETS_DIR, dir, "#{source}.#{ext}"))
(asset_tag_helper.rb line 489; in this particular case ext will be
nil
and source will be foo.png, dir will be images)
Fred
Seems to me like a bug in Ruby. See:
File.exist?(File.join(RAILS_ROOT,'public/images/','rails.png'))
=> true
Doesn't happen with my ruby (on a mac)
Fred
Well something like File.exist? lying to you is going to be annoying to workaround. I'd probably try and workout why it's doing that.
A simple fix might be to avoid image_tag for now.
Fred