我的应用程序基于Rails 3.2.2.
面对一些奇怪的问题:开发/生产中的所有操作都被调用两次。有什么建议么?Rails 3.2.2操作被调用两次
Started GET "/faqs" for 127.0.0.1 at 2012-07-07 17:08:06 +0200
Processing by FaqsController#index as HTML
Faq Load (0.5ms) SELECT `faqs`.* FROM `faqs` WHERE `faqs`.`active` = 1 ORDER BY position asc
Rendered faqs/index.html.haml within layouts/application (3.1ms)
Rendered shared/_navigation_bar.html.haml (5.3ms)
Rendered devise/registrations/_register.html.erb (5.5ms)
Completed 200 OK in 137ms (Views: 43.3ms | ActiveRecord: 0.5ms | Solr: 0.0ms)
Started GET "/faqs" for 127.0.0.1 at 2012-07-07 17:08:06 +0200
Processing by FaqsController#index as */*
Faq Load (0.2ms) SELECT `faqs`.* FROM `faqs` WHERE `faqs`.`active` = 1 ORDER BY position asc
Rendered faqs/index.html.haml within layouts/application (0.2ms)
Rendered shared/_navigation_bar.html.haml (3.9ms)
Rendered devise/registrations/_register.html.erb (12.1ms)
Completed 200 OK in 33ms (Views: 30.2ms | ActiveRecord: 0.2ms | Solr: 0.0ms)
更新#1
简单的控制器:
class FaqsController < ApplicationController
respond_to :html
def index
@faqs = Faq.all
respond_with(@faqs)
end
end
观很简单太:
%h2 Faqs
- @faqs.each_with_index do |faq, index|
.span9
%h3
= "%d." % (index + 1)
= faq.title
%p= faq.body
看起来可能是jquery-rails。在你的浏览器中拉一个检查员,看看你是否在做一些AJAX-ey的事情。 – 2012-07-07 16:40:45
这些请求适用于不同的MIME类型:'FaqsController#index as HTML'和'FaqsController#index */*'。这个世界如何?! – Zabba 2012-07-07 18:14:35
@DeanBrundage AJAX没有提出任何请求。 c – Maestro 2012-07-07 20:40:12