what is that get in routes?

I've create a operator_session_controller:

class OperatorSessionsController < ApplicationController

  def destroy     reset_session     redirect_to 'https://…'   end

end

I've put resource :operator_session in routes.rb. It's all ok. Suddenly I see in routes.rb the line:

get "operator_session/destroy"

It was automatically put on. What does it mean?

Can you please post the entire content of routes.rb. And what is your rails version and any other routes based plugins are installed in your application?

I'm using rails 3.0, I don't have plugins installed but only gems and they are:

abstract (1.0.0)     actionmailer (3.0.0)       actionpack (= 3.0.0)       mail (~> 2.2.5)     actionpack (3.0.0)       activemodel (= 3.0.0)       activesupport (= 3.0.0)       builder (~> 2.1.2)       erubis (~> 2.6.6)       i18n (~> 0.4.1)       rack (~> 1.2.1)       rack-mount (~> 0.6.12)       rack-test (~> 0.5.4)       tzinfo (~> 0.3.23)     activemodel (3.0.0)       activesupport (= 3.0.0)       builder (~> 2.1.2)       i18n (~> 0.4.1)     activerecord (3.0.0)       activemodel (= 3.0.0)       activesupport (= 3.0.0)       arel (~> 1.0.0)       tzinfo (~> 0.3.23)     activerecord-jdbc-adapter (0.9.7-java)     activerecord-jdbcpostgresql-adapter (0.9.7-java)       activerecord-jdbc-adapter (= 0.9.7)       jdbc-postgres (>= 8.4.701)     activeresource (3.0.0)       activemodel (= 3.0.0)       activesupport (= 3.0.0)     activesupport (3.0.0)     arel (1.0.1)       activesupport (~> 3.0.0)     builder (2.1.2)     erubis (2.6.6)       abstract (>= 1.0.0)     i18n (0.4.1)     jdbc-postgres (8.4.701-java)     mail (2.2.5)       activesupport (>= 2.3.6)       mime-types       treetop (>= 1.4.5)     mime-types (1.16)     polyglot (0.3.1)     rack (1.2.1)     rack-mount (0.6.12)       rack (>= 1.0.0)     rack-test (0.5.4)       rack (>= 1.0)     rails (3.0.0)       actionmailer (= 3.0.0)       actionpack (= 3.0.0)       activerecord (= 3.0.0)       activeresource (= 3.0.0)       activesupport (= 3.0.0)       bundler (~> 1.0.0)       railties (= 3.0.0)     railties (3.0.0)       actionpack (= 3.0.0)       activesupport (= 3.0.0)       rake (>= 0.8.4)       thor (~> 0.14.0)     rake (0.8.7)     rubycas-client (2.2.1)       activesupport     thor (0.14.0)     treetop (1.4.8)       polyglot (>= 0.3.1)     tzinfo (0.3.23)     will_paginate (3.0.pre2)

The routes.rb is:

Sacchetti::Application.routes.draw do   get "operator_session/destroy"

  resources :bags

  resources :admins

  resources :districts

  resources :operators do     resources :deliveries   end

  resources :rusers do     resources :deliveries     resources :doc_details     resources :delegates   end

  resource :operator_session

   match ':controller(/:action(/:id(.:format)))' end

I don't understand that get "operator_session/destroy".

It just means that it's a GET request from your browser as opposed to POST, PUT, or DELETE http methods. For example: GET would be used when you want to simply load a page, POST would be used if you wanted to submit a form.

This is all pretty well documented in the rails guides:

Luke

Yes but I just have resource :operator_session in my routes.rb. My question is: why rails put automatically that get "operator_session/destroy"?

If you generated that controller then perhaps rails assumed a GET was the safest thing to default?

What command line did you use to generate it ? If you specify only one action I think it assumes that it's a GET request even though destroy would usually correspond with a DELETE request. I suggest you delete the line and forget about it.

Luke