我在我的客户端的Rails 2.3.8应用程序中使用Authlogic作为我的身份验证系统。我有一个模型,CommunityEventUser,需要使用新属性进行更新。控制器代码是这样的:
def edit
@user = current_user
end
def update
@user = current_user
if @user.update_attributes(params[:community_event_user])
flash[:notice] = "You updated your profile!"
redirect_to community_event_user_path
else
render :action => :edit
end
end
这只是标准的编辑/更新RESTful代码。当我转到视图以编辑用户帐户信息时,提交包含password
和password_confirmation
之外的任何属性的更改的表单,并将最后两个字段留空以将我重定向到包含此错误的页面:
Template is missing
Missing template community_event_users/edit.erb in view path app/views
这个网址:
http://localhost:3000/events/user.%23%3Ccommunityeventuser:0x10495ad80%3E
但是,当我在两个密码字段中匹配密码时,用户会正确更新。我认为标准的Authlogic使用只允许在更新时忽略空白password
和password_confirmation
字段。这可能是什么问题?
查看编辑代码:
- set_page_title "Login - Community Calendar"
%h2.replaced#h2-edit_account Edit Account
- content_for :sidebar do
= render :partial => 'community_events/sidebar'
= render 'community_event_user'
答案 0 :(得分:0)
而不是
render :action => :edit
你可以使用:
render :template => "community_event_users/edit"
那么,你有一个像这样的文件: “yourapp / views / community_event_users / edit.erb”?
如果没有,请使用edit-view-file的路径。