我下面的教程,我尝试调用删除方法是这样的:在不能调用一个HTTP方法删除不删除回报率
用户/index.html.erb我:
<!-- View for index action in user's controleer -->
<h1>All users - Administration Page</h1>
<%= will_paginate %>
<ul class="users">
<% @users.each do |user| %>
<li>
<%= link_to user.name, user %>
<!-- if the current user is admin -->
<% if current_user.admin? && !current_user?(user) %>
| <%= link_to "delete", user, method: :delete, confirm: "You sure?" %>
<% end %>
</li>
<% end %>
</ul>
<%= will_paginate %>
在我的用户控制,我得到这个:
#destroying users!
def destroy
User.find(params[:id]).destroy
flash[:success] = "User destroyed."
redirect_to users_path
end
不是得到一个确认框的,我被重定向到用户的个人资料? 看来,rails服务器无法读取我发送给它的删除方法!
编辑: 耙路线:
rake routes
intergration_test_authentication_pages GET /intergration_test/authentication_pages(.:format) intergration_test#authentication_pages
root / static_pages#home
user_profile /user_profile(.:format) users#show_user
all_videos /all_videos(.:format) static_pages#allvideos
show_interface /show_interface(.:format) static_pages#interface
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
sessions POST /sessions(.:format) sessions#create
new_session GET /sessions/new(.:format) sessions#new
session DELETE /sessions/:id(.:format) sessions#destroy
signup /signup(.:format) users#new
signin /signin(.:format) sessions#new
signout /signout(.:format) sessions#destroy
他使用新的Ruby 1.9语法,这意味着他的语法是好的。 – 2012-04-08 22:21:21