我的應用程序基於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