Note that there are some explanatory texts on larger screens.

plurals
  1. PORails 3.2.x routes being called twice
    primarykey
    data
    text
    <p>I've got a weird issue where any get request are being called twice. Here is the log output</p> <p>First call</p> <pre><code>Started GET "/admin/dashboard" for 127.0.0.1 at 2013-02-14 17:42:33 -0500 Processing by Admin::DashboardController#index as HTML </code></pre> <p>Second call right after</p> <pre><code>Started GET "/admin/dashboard" for 127.0.0.1 at 2013-02-14 17:42:34 -0500 Processing by Admin::DashboardController#index as */* </code></pre> <p>Here is my routes output</p> <pre><code> admin_dashboard_index GET /admin/dashboard(.:format) admin/dashboard#index POST /admin/dashboard(.:format) admin/dashboard#create new_admin_dashboard GET /admin/dashboard/new(.:format) admin/dashboard#new edit_admin_dashboard GET /admin/dashboard/:id/edit(.:format) admin/dashboard#edit admin_dashboard GET /admin/dashboard/:id(.:format) admin/dashboard#show PUT /admin/dashboard/:id(.:format) admin/dashboard#update DELETE /admin/dashboard/:id(.:format) admin/dashboard#destroy </code></pre> <p>And my routes.rb</p> <pre><code> namespace :admin do resources :pages do member do get 'visual' end end resources :dashboard, :posts, :help end </code></pre> <p>Is this normal? It happens in both development and product and as a consequence each GET call is also making a database query.</p> <p>Update: Adding controller output</p> <p>Here is my admin/dashboard_controller</p> <pre><code>class Admin::DashboardController &lt; AdminController def index @authentications = current_user.authentications @has_facebook = @authentications.find_by_provider(:facebook) if @has_facebook @fb_me = FbGraph::User.me(@has_facebook.token) @fb_me.fetch end end </code></pre> <p>And my admin_controller</p> <pre><code>class AdminController &lt; ApplicationController before_filter :authenticate_user! layout "admin/layouts/application" end end </code></pre> <p>And my application_controller:</p> <pre><code>class ApplicationController &lt; ActionController::Base before_filter :set_locale before_filter :set_company before_filter :subdomain_view_path protect_from_forgery prepend_view_path "app/views/admin" rescue_from CanCan::AccessDenied do |exception| redirect_to root_path, :alert =&gt; exception.message end rescue_from ActiveRecord::RecordNotFound do |exception| redirect_to root_path, :alert =&gt; exception.message end def set_locale I18n.locale = I18n.default_locale end def set_company if current_user @current_account = current_user.company return end if request.subdomain.present? and request.subdomain != 'www' @current_account = Company.find_by_subdomain(request.subdomain) else if request.domain.present? @current_account = Company.find_by_subdomain(request.domain.split('.')[0]) end end if not @current_account @current_account = Company.find_by_subdomain('default') end end def subdomain_view_path if request.subdomain.present? and request.subdomain != 'www' prepend_view_path "app/views/#{request.subdomain}_subdomain" else if request.domain.present? prepend_view_path "app/views/#{request.domain.split('.')[0]}_subdomain" else prepend_view_path "app/views/default_subdomain" end end end def check_addon_product if @current_account.addons.find_by_title('products') return true else redirect_to root_path, :alert =&gt; "Products addon not enabled for this account." end end end </code></pre> <p>I suspect im doing something wrong in the application_controller.</p> <p>Update 2:</p> <p>So i tried three different methods and all but Google Chrome made the request once. I don't know if this is a known issue or not but thanks to the commenters for pointing me in the right direction.</p> <p>Update 3:</p> <p>Found this related bug <a href="http://code.google.com/p/chromium/issues/detail?id=39402" rel="nofollow">http://code.google.com/p/chromium/issues/detail?id=39402</a></p> <p>Other than providing a favicon is there a way around this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload