zabumba
zabumba

Reputation: 12412

favicon causing problems

Since I added my favicon to my website:

<HEAD>
   ...
   <link rel="shortcut icon" href="biowatts.ico" />
   <link rel="icon" href="biowatts.ico" type="image/vnd.microsoft.icon"/>
</HEAD>

I get it often sent as a parameter in my URL and it's causing lots of issues such as this one:

A ActiveRecord::StatementInvalid occurred in biogas_calculator#show_biomass_configuration:

 PG::Error: ERROR:  invalid input syntax for integer: "biowatts"
: SELECT "power_plants".* FROM "power_plants"  WHERE (id = 'biowatts' AND user_id = 355)
 .bundle/gems/ruby/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:1021:in `async_exec'

-------------------------------
Request:
-------------------------------

 * URL : http://mywebsite.com/biogas_calculator/show_biomass_configuration/biowatts.ico
 * Parameters: {"controller"=>"biogas_calculator", "action"=>"show_biomass_configuration", "id"=>"biowatts", "format"=>"ico"}
 * Rails root: /app

Any idea why this is happening? I work on mac, could it be IE issue?

Upvotes: 0

Views: 370

Answers (2)

iltempo
iltempo

Reputation: 16012

Make the favicon urls being absolute. Otherwise if you are on a resources url Rails tries to find the resource.

<link rel="shortcut icon" href="/biowatts.ico" />
<link rel="icon" href="/biowatts.ico" type="image/vnd.microsoft.icon"/>

Upvotes: 2

Ryan Bigg
Ryan Bigg

Reputation: 107728

You have a route in your application that catches all unknown requests and routes to the biogas_calculator controller. It's attempting to use biowatts as the :id parameter for the request.

Are you super super sure you put the biowatts.ico in the public folder of your application?

Upvotes: 2

Related Questions