我所有的 rails 3.2.2 ActiveRecord 方法都被执行了两次。我注意到每个执行的处理方式都不同,请参阅我从下面的控制台中获取的示例...
Started GET "/api/bills/Jeremy%20Fox" for 127.0.0.1 at 2012-03-20 23:16:43 -0400
Processing by BillsController#show as HTML
Parameters: {"username"=>"Jeremy Fox"}
BillsForUsers Load (2.4ms) SELECT "bills_for_users".* FROM "bills_for_users" WHERE "bills_for_users"."billusername" = 'Jeremy Fox'
Completed 200 OK in 47ms (Views: 11.2ms | ActiveRecord: 2.4ms)
Started GET "/api/bills/Jeremy%20Fox" for 127.0.0.1 at 2012-03-20 23:16:44 -0400
Processing by BillsController#show as */*
Parameters: {"username"=>"Jeremy Fox"}
BillsForUsers Load (1.1ms) SELECT "bills_for_users".* FROM "bills_for_users" WHERE "bills_for_users"."billusername" = 'Jeremy Fox'
Completed 200 OK in 33ms (Views: 28.1ms | ActiveRecord: 1.1ms)
谁能向我解释为什么我所有的 ActiveRecord 方法都被执行两次和/或
Processing by BillsController#show as HTML
和 Processing by BillsController#show as */*
之间的区别是什么?谢谢。
最佳答案
事实证明,问题实际上是 JSONView Chrome 扩展。正如它在选项菜单中所说的那样......
在花了几天时间试图弄清楚我的代码做错了什么之后,它实际上只是 chrome!
希望没有其他人遇到这个愚蠢的问题。
-杰里米
关于ruby-on-rails - "Processing by Contoller#method as */*"和 "Processing by BillsController#show as HTML"有什么区别,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9798237/