新模型索引页面,显示其他模型索引页面

时间:2012-12-08 02:18:24

标签: ruby-on-rails routing scaffolding

我用:

生成了新模型
  

rails生成脚手架网站

然后我试图显示所有条目,但不是显示/ sites它显示/ devices

> rake routes
>   test_on GET    /test/on(.:format)                test#on
         test_off GET    /test/off(.:format)               test#off
         power_on GET    /power/on(.:format)               power#on
        power_off GET    /power/off(.:format)              power#off
      power_cycle GET    /power/cycle(.:format)            power#cycle
       home_index GET    /home/index(.:format)             home#index
      devices_new GET    /devices/new(.:format)            devices#new
  devices_destroy DELETE /devices/destroy(.:format)        devices#destroy
    turnon_device PUT    /devices/:id/turnon(.:format)     devices#turnon
   turnoff_device PUT    /devices/:id/turnoff(.:format)    devices#turnoff
powercycle_device PUT    /devices/:id/powercycle(.:format) devices#powercycle
  getsites_device GET    /devices/:id/getsites(.:format)   devices#getsites
          devices GET    /devices(.:format)                devices#index
                  POST   /devices(.:format)                devices#create
       new_device GET    /devices/new(.:format)            devices#new
      edit_device GET    /devices/:id/edit(.:format)       devices#edit
           device GET    /devices/:id(.:format)            devices#show
                  PUT    /devices/:id(.:format)            devices#update
                  DELETE /devices/:id(.:format)            devices#destroy
            users GET    /users(.:format)                  users#index
                  POST   /users(.:format)                  users#create
         new_user GET    /users/new(.:format)              users#new
        edit_user GET    /users/:id/edit(.:format)         users#edit
             user GET    /users/:id(.:format)              users#show
                  PUT    /users/:id(.:format)              users#update
                  DELETE /users/:id(.:format)              users#destroy
            sites GET    /sites(.:format)                  sites#index
                  POST   /sites(.:format)                  sites#create
         new_site GET    /sites/new(.:format)              sites#new
        edit_site GET    /sites/:id/edit(.:format)         sites#edit
             site GET    /sites/:id(.:format)              sites#show
                  PUT    /sites/:id(.:format)              sites#update
                  DELETE /sites/:id(.:format)              sites#destroy
             root        /                                 devices#index

感谢任何帮助 谢谢, d

1 个答案:

答案 0 :(得分:0)

你是什​​么意思?你有两个:

      devices GET    /devices(.:format)                devices#index
        sites GET    /sites(.:format)                  sites#index

你能否就你的问题写一些更好的解释?