ActiveRecord :: RecordNotFound - 找不到id = favicon.ico的位置

时间:2013-06-07 03:33:55

标签: ruby sinatra

我在本地运行Sinatra应用程序并且工作正常,但我无法将应用程序部署到heroku或EC2。我在我的日志(本地)中获得了关于favicon.ico的以下信息。我已将此文件添加到我的应用程序中,但它仍然给我这个:

ActiveRecord :: RecordNotFound - 找不到ID = favicon.ico的位置

有关如何解决此问题的任何想法?

== Sinatra/1.4.2 has taken the stage on 4567 for development with backup from Thin
>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on localhost:4567, CTRL+C to stop
D, [2013-06-06T20:18:30.470678 #1786] DEBUG -- :   Location Load (0.2ms)  SELECT "locations".*        FROM "locations" 
127.0.0.1 - - [06/Jun/2013 20:18:30] "GET / HTTP/1.1" 200 2552 0.0419
D, [2013-06-06T20:18:30.763844 #1786] DEBUG -- :   Location Load (0.2ms)  SELECT "locations".*   FROM "locations" WHERE "locations"."id" = ? LIMIT 1  [["id", "favicon.ico"]]
ActiveRecord::RecordNotFound - Couldn't find Location with id=favicon.ico:
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/activerecord- 3.2.13/lib/active_record/relation/finder_methods.rb:343:in `find_one'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.13/lib/active_record/relation/finder_methods.rb:314:in `find_with_ids'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.13/lib/active_record/relation/finder_methods.rb:107:in `find'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.13/lib/active_record/querying.rb:5:in `find'
app.rb:36:in `block in <main>'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1415:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1415:in `block in compile!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:944:in `[]'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:944:in `block (3 levels) in route!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:960:in `route_eval'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:944:in `block (2 levels) in route!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:981:in `block in process_route'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:979:in `catch'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:979:in `process_route'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:943:in `block in route!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:942:in `each'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:942:in `route!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1053:in `block in dispatch!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `block in invoke'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `catch'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `invoke'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1050:in `dispatch!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:878:in `block in call!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `block in invoke'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `catch'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `invoke'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:878:in `call!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:864:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-protection-1.5.0/lib/rack/protection/xss_header.rb:18:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-protection-1.5.0/lib/rack/protection/path_traversal.rb:16:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-protection-1.5.0/lib/rack/protection/json_csrf.rb:18:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-protection-1.5.0/lib/rack/protection/frame_options.rb:31:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.5.2/lib/rack/logger.rb:15:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.5.2/lib/rack/commonlogger.rb:33:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:209:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:202:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/showexceptions.rb:21:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:172:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1947:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1610:in `block in call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1693:in `synchronize'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1610:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/thin-1.5.1/lib/thin/connection.rb:81:in `block in pre_process'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/thin-1.5.1/lib/thin/connection.rb:79:in `catch'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/thin-1.5.1/lib/thin/connection.rb:79:in `pre_process'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/eventmachine-1.0.3/lib/eventmachine.rb:1037:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/eventmachine-1.0.3/lib/eventmachine.rb:1037:in `block in spawn_threadpool'

1 个答案:

答案 0 :(得分:0)

您是否有/:something路由,然后尝试根据:something从数据库加载记录。似乎浏览器要求/favicon.ico并且您的应用正在尝试在数据库中查询标识为favicon.ico的记录。

你有一条/:something路线,如果有的话,它会做什么?