Ruby on Rails Error. Processing Controller method as png

ruby, ruby-on-rails, ruby-on-rails-4

Solution

Many browsers look for `favicon.png` files on your server (that is the icon shown near the title of the page). It is a known symptom seeing 404s for `favicon.png` in server logs.

The easiest way to avoid a browser looking at internal links for a `favicon` is to put a `favicon.ico` at the website root, or to add a `<link rel` to your layout template:

<link rel="shortcut icon" href="http://example.com/myicon.ico" />

Problem

I have given this in my route. ``` get '/custom_page/:name' => 'custom_page#load_content' ``` And this is my controller method. ``` def load_content page_name = (params[:name]).split("_").join(" ") p "---------------------" p page_name end ``` Thing is im getting 2 get calls inside my console. and hence an error. here is what my console looks like.. ``` Started GET "/en/custom_page/Nidhin_Test_Page" for 127.0.0.1 at 2014-05-12 11:50:34 +0530 ActiveRecord::SchemaMigration Load (0.2ms) SELECT `schema_migrations`.* FROM `schema_migrations` Processing by CustomPageController#load_content as HTML Parameters: {"locale"=>"en", "name"=>"Nidhin_Test_Page"} "---------------------" "Nidhin Test Page" Rendered custom_page/load_content.html.erb within layouts/calculator (2.4ms) User Load (0.2ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 2 ORDER BY `users`.`id` ASC LIMIT 1 Rendered layouts/_calculator_script_top.html.erb (45.4ms) Rendered layouts/_calculator_header.html.erb (217.5ms) MenuItem Load (0.2ms) SELECT `menu_items`.* FROM `menu_items` ORDER BY `menu_items`.`menu_priority` ASC Rendered layouts/_calculator_menu.html.erb (15.4ms) Rendered layouts/_calculator_script_bottom.html.erb (0.6ms) Completed 200 OK in 325ms (Views: 295.8ms | ActiveRecord: 3.9ms) Started GET "/en/custom_page/favicon.png" for 127.0.0.1 at 2014-05-12 11:50:35 +0530 Processing by CustomPageController#load_content as PNG Parameters: {"locale"=>"en", "name"=>"favicon"} "---------------------" "favicon" Completed 500 Internal Server Error in 6ms Rendered /home/nithin/.rvm/gems/ruby-2.0.0-p353/gems/exception_notification-4.0.1/lib/exception_notifier/views/exception_notifier/_request.text.erb (3.3ms) Rendered /home/nithin/.rvm/gems/ruby-2.0.0-p353/gems/exception_notification-4.0.1/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.6ms) Rendered /home/nithin/.rvm/gems/ruby-2.0.0-p353/gems/exception_notification-4.0.1/lib/exception_notifier/views/exception_notifier/_session.text.erb (0.8ms) Rendered /home/nithin/.rvm/gems/ruby-2.0.0-p353/gems/exception_notification-4.0.1/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.2ms) Rendered /home/nithin/.rvm/gems/ruby-2.0.0-p353/gems/exception_notification-4.0.1/lib/exception_notifier/views/exception_notifier/_environment.text.erb (3.2ms) Rendered /home/nithin/.rvm/gems/ruby-2.0.0-p353/gems/exception_notification-4.0.1/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.2ms) Rendered /home/nithin/.rvm/gems/ruby-2.0.0-p353/gems/exception_notification-4.0.1/lib/exception_notifier/views/exception_notifier/_backtrace.text.erb (0.6ms) Rendered /home/nithin/.rvm/gems/ruby-2.0.0-p353/gems/exception_notification-4.0.1/lib/exception_notifier/views/exception_notifier/exception_notification.text.erb (34.7ms) An ActionView::MissingTemplate occurred in custom_page#load_content: Missing template custom_page/load_content with {:locale=>[:en], :formats=>[:png], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee, :arb]}. Searched in: * "/home/nithin/mobomo/Projects/sfth/app/views" * "/home/nithin/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-c4a123d48850/app/views" * "/home/nithin/.rvm/gems/ruby-2.0.0-p353/gems/kaminari-0.15.0/app/views" * "/home/nithin/.rvm/gems/ruby-2.0.0-p353/gems/devise-3.2.2/app/views" ``` Why is that favicon coming? How to prevent this from getting called? `Processing by CustomPageController#load_content as PNG`

Original source