0

I was reading through the blog post Authentication with Warden, devise-less, but one thing in that post is how he approaches the routing. So which one is more logical: the authors way

resources :users do
  collection do
    # Registrations is set as plural, which means that each user can make many 
    # registrations, and open many sessions and so will make many confiramtions
    resource :registrations, only: [:show, :create]
    resource :sessions, only: [:new, :create, :destroy]
    resource :confirmations, only: [:show]
  end
end 

my way

resources :users do
  collection do
    # Their is only one registration for each user, so why we use it in plural
    resource :registration, only: [:show, :create]
    # the same with session and confirmation
    resource :session, only: [:new, :create, :destroy]
    resource :confirmation, only: [:show]
  end
end

I am a little confused about the collection and member features in rails routing, so which one is more logical.

Nafaa Boutefer
  • 2,169
  • 19
  • 26

1 Answers1

0

Since a resource more or less equals a controller in the Rails world and controllers should have plural names I would vote for the authors version.

Community
  • 1
  • 1
Ulrich Thomas Gabor
  • 6,584
  • 4
  • 27
  • 41