在routes.rb中使用数组

时间:2012-10-24 15:22:23

标签: ruby-on-rails ruby-on-rails-3

使用Rails 3.我有以下内容:

# shop.rb
SHOP_TYPES = %w(cafe restaurant station)

# routes.rb
resources :shops do
  member do
    get :nearby_cafes, :nearby_restaurants, :nearby_stations
  end
end

我每次在routes.rb数组中添加其他成员时都不会更新SHOP_TYPES,而是在routes.rb中读取数组吗?

感谢。

1 个答案:

答案 0 :(得分:1)

TYPES = :nearby_cafes, :nearby_restaurants, :nearby_stations
 ....
get *TYPES