【发布时间】:2015-07-11 05:58:39
【问题描述】:
我创建了一个控制器并添加了默认的 7 个操作方法,我还创建了 4 个视图,它们是 index 、 new 、 show 、 edit 都包含不同的数据
also added resources :posts controller configuration into my routing file as well
'
My problem is when i try to navigate to index or edit views using url .. it displays me only show views , however index method is working as a default
below are my urls `enter code here`
1 . http://localhost:3000/posts/index[^]
如果我尝试这个,它会给我显示视图数据
- localhost:3000/帖子
这给了我正确的索引数据(默认不提及索引操作名称)
这个但总是向我显示显示视图中存在的数据,而不是编辑视图中存在的数据
请推荐
下面是我的路由文件中的几行。
Hide Copy Code
Rails.application.routes.draw do
get 'home/index'
resources :posts
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root 'home#index'
【问题讨论】:
标签: ruby-on-rails ruby