1

I have noticed that in Rails 3.2.2, all actions are being processed with */* format. So the question is: what means */* ? And why it is called by default (every time) ?

Because there are two processings for one action:

Started GET "/" for 127.0.0.1 at 2012-07-07 22:50:22 +0200
Processing by MainController#index as HTML

Started GET "/" for 127.0.0.1 at 2012-07-07 22:50:22 +0200
Processing by MainController#index as */*

I have tried to set:

  respond_to :html

  def index
    @posts = Post.all
    respond_with(@posts)
  end

But the same problem still exists.


Just created project based on Rails 3.2.6. Tested with Thin 1.4.1 and Webrick. Same issue:

=> Booting Thin
=> Rails 3.2.6 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
>> Thin web server (v1.4.1 codename Chromeo)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop

Started GET "/mains" for 127.0.0.1 at 2012-07-09 10:53:55 +0200
Connecting to database specified by database.yml
Processing by MainsController#index as HTML
  Main Load (0.1ms)  SELECT `mains`.* FROM `mains` 
  Rendered mains/index.html.erb within layouts/application (2.7ms)
Completed 200 OK in 97ms (Views: 51.6ms | ActiveRecord: 1.3ms)


Started GET "/mains" for 127.0.0.1 at 2012-07-09 10:53:55 +0200
Processing by MainsController#index as */*
  Main Load (0.1ms)  SELECT `mains`.* FROM `mains` 
  Rendered mains/index.html.erb within layouts/application (0.5ms)
Completed 200 OK in 10ms (Views: 8.6ms | ActiveRecord: 0.1ms)
Maestro
  • 75
  • 1
  • 7
  • That just means anything/anything ie localhost/users/index, localhost/posts/index, etc. You could just setup your root route and your controller routes – Chris McKnight Jul 07 '12 at 21:09
  • Yes, it looks like so, but `root_path` is set already. I just don't understand why it is being called on every action? – Maestro Jul 07 '12 at 21:14
  • I've noticed that Internet Explorer likes to do this if you hit Refresh. – jdoe Jul 07 '12 at 21:39
  • Unfortunately same for refresh or simple process and it is Google Chrome. – Maestro Jul 07 '12 at 21:58

0 Answers0