What is the difference in "Handling Contoller # as * / *" and "Handling BillsController # show as HTML"

All my rails 3.2.2. ActiveRecord methods are executed twice. I noticed that each execution is handled differently, see the examples I grabbed from the console below ...

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)

      

Can someone explain to me why all my ActiveRecord methods are being executed twice and / or what's the difference between Processing by BillsController#show as HTML

and Processing by BillsController#show as */*

?

Thank.

+3


source to share


2 answers


It turns out that the problem was actually the JSONView Chrome extension. Since it's in the options menu ...

Use a secure method to parse the HTTP response (*)

(*): The secure method forces the browser to send an additional HTTP request to receive the raw HTTP content.

After spending days trying to figure out what I was doing wrong in my code, it was actually just chrome!



Hope no one comes across this stupid problem.

-Jeremy

+2


source


I was struggling with this same problem. The HTML Validator Chrome extension is also the culprit (none of the small print).

In my case, I am calling a search query with ModestModel support, so the first hit (and rendering) succeeded, then phantom 500, since my non-DB search model was out of scope and nil the second query.



Thanks Jeremy!

0


source







All Articles