Rails routing – :on => :collection

Routes on collections are listed here.

The difference between :on => :collection and :on => :member are the style of route they produce and their associated route helpers.

resources :posts do
  # on collection
  get 'search', on: :collection 
  # --> generates '/posts/search' and search_posts_path

  # on member
  get 'share', on: :member      
  # --> generates'/posts/:id/share' and share_photo_path(@post)
end

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)