添加子頁面使用RoR的2.3.8不能在控制器
這是我cities_controller.rb
class CitiesController < ApplicationController
def show
@city = City.find(params[:id])
...
end
def shops
...
end
def countries
...
end
end
這裏是我的routes.rb
map.resources :cities, :collection => {:shops => :get, :countries => :get}
的show
網址爲每個id
是:
http://localhost/cities/1
我希望有一些內容shops
和countries
每個相關id
,我想:
http://localhost/cities/1/shops
http://localhost/cities/1/countries
我不能讓網頁顯示,空碼擺在首位。我做錯了什麼?
謝謝。
是的,我用控制器搜索一些東西,並在視圖中顯示結果,但在模型方面,沒有關聯。數據結構只是一個例子。 :P – Victor 2011-04-14 05:03:28