0
你好,我正在開發一個關於用戶註冊的應用程序,但是當用戶X想編輯他的信息時,應用程序正在進行「編輯」而不是用戶ID,並向我顯示以下錯誤:ActiveRecord :: RecordNotFound UserController#show
ActiveRecord::RecordNotFound in UserController#show
Couldn't find User with id=edit
(我用的設計爲用戶),這是我home.html.rb
<body>
<div class="container">
<% if signed_in? %>
<table class="front" summary="For signed-in users">
<tr>
<td class="main">
<h1 class="micropost">What's up?</h1>
<%= link_to "edit your profile", edit_user_registration_path, :class => "signup_button round" %>
</td>
</tr>
</table>
<% else %>
<h1>Sample App</h1>
<p>
This is the home page for the <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a> sample application.
</p>
<%= link_to "Sign up now!", new_user_registration_path, :class => "signup_button round" %>
<% end %>
</div>
這是我的routes.rb(我知道這應該是用戶,但如果我把t帽子複數不`噸工作)
Estaciones::Application.routes.draw do
root :to => "static_pages#home"
match '/contact', :to=>'static_pages#contact'
match '/about', :to=>'static_pages#about'
get "user/:id" => "User#show"
devise_for :user
resources :user do
end
最後,這裏是我的UserController的
class UserController < ApplicationController
def new
@user = User.new
end
def create
@user = User.new(params[:user])
if @user.save
redirect_to user_session_path
else
redirect_to new_user_session_path
end
end
def show
@user = User.find(params[:id])
#redirect_to @user
end
end
也是我把跟蹤 應用程序/控制器/ user_controller.rb:18:在'秀」 – Asantoya17 2012-07-24 17:41:10
因爲你有奇異的資源,不會爲多個用戶 – mask8 2012-07-24 17:58:54
感謝一個固定的工作,非常感謝 – Asantoya17 2012-07-24 18:09:50