加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Ruby on Rails错误.处理控制器方法为png

发布时间:2020-12-17 03:49:06 所属栏目:百科 来源:网络整理
导读:我已经在我的路线上给了这个. get '/custom_page/:name' = 'custom_page#load_content' 这是我的控制器方法. def load_content page_name = (params[:name]).split("_").join(" ") p "---------------------" p page_nameend 事情是我在我的控制台内得到2个
我已经在我的路线上给了这个.

get '/custom_page/:name' => 'custom_page#load_content'

这是我的控制器方法.

def load_content
    page_name = (params[:name]).split("_").join(" ")
    p "---------------------"
    p page_name
end

事情是我在我的控制台内得到2个电话.因此是一个错误.
这是我的控制台看起来像..

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"

为什么这个图标来了?如何防止被调用?由CustomPageController#load_content处理为PNG

解决方法

许多浏览器在服务器上查找favicon.png文件(即页面标题附近显示的图标).这是在服务器日志中看到 404s for favicon.png的已知症状.

避免浏览器查看favicon的内部链接的最简单方法是在网站根目录下放置favicon.ico,或者在您的布局模板中添加<link rel

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读