. (DOT) appended to image_tag? Double-U TF!

Hey guys,

some funny stuff is going on.

image_tag ‘items/1.png’ # => 1
<-- Note the . (DOT) !

image_tag ‘items/1.jpg’ # => 1
<-- no Dot

Does anyone have an idea whats going on here?

Uuuuhhmm… Help please :slight_smile:

Cheers,
Stefan

image_tag ‘items/1.abcd’ # => 1

As it seems the dot is only added to files that physically exist.

Andrius C. wrote:

Maybe you overloaded image_tag method somewhere in your helpers?

On Aug 14, 9:09�pm, Stefan B. [email protected]

Hey.

unfortunately I havent. So this cant be the reason for it. Sadly.

Funny thing is, it happens on both of my machines with a completely
empty rails project.

Maybe you overloaded image_tag method somewhere in your helpers?

On Aug 14, 9:09 pm, Stefan B. [email protected]

Ryan B. 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” %>
#=> Rails

Setting ENV[“RAILS_ASSET_ID”] = ‘’ produces
#=> Rails

Its giving me a real headache

Version of rails?

On 15 Aug 2008, at 13:16, Stefan B. wrote:

Ryan B. 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

Frederick C. wrote:

On 15 Aug 2008, at 13:16, Stefan B. wrote:

Ryan B. 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

On 15 Aug 2008, at 13:44, Stefan B. wrote:

source += “.#{ext}” if ext && File.extname(source).blank? ||
File.exist?(File.join(RAILS_ROOT,‘public/images/’,‘rails.png’))
=> true

Doesn’t happen with my ruby (on a mac)

Fred

On 15 Aug 2008, at 14:11, Stefan B. wrote:

Fred

So seems like a win32 related bug then?

How would I fix it? (while keeping windows)

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

Frederick C. wrote:

On 15 Aug 2008, at 14:11, Stefan B. wrote:

Fred

So seems like a win32 related bug then?

How would I fix it? (while keeping windows)

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

Another possibility is to use image_tag “bla.jpg?” which isnt found by
file.exists but doesnt bother the request.

Since it happens on all win32 machines regardless of the server, I
really wonder why nobody else has come across this.

Frederick C. wrote:

On 15 Aug 2008, at 13:44, Stefan B. wrote:

source += “.#{ext}” if ext && File.extname(source).blank? ||
File.exist?(File.join(RAILS_ROOT,‘public/images/’,‘rails.png’))
=> true

Doesn’t happen with my ruby (on a mac)

Fred

So seems like a win32 related bug then?

How would I fix it? (while keeping windows)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs