什么是集合,什么是成员?

时间:2013-02-20 11:29:47

标签: ruby-on-rails

什么是集合,什么是成员?

resources :photos do
  member do
    get :preview
  end
end

VS

resources :photos do
  collection do
    get :search
  end
end

1 个答案:

答案 0 :(得分:0)

第一个让你请求[GET]:

/photos/1/preview

# action 'preview' within PhotosController with params[:photo_id] == 1

第二个让你请求[GET]:

/photos/search

# action 'search' within PhotosController