开发者

Template Missing Error Appears When Updating a User and not Providing a Password - Authlogic

开发者 https://www.devze.com 2023-03-26 09:39 出处:网络
I\'m using Authlogic for my authentication system in a Rails 2.3.8 application for a client of mine. I have a model, CommunityEventUser, that needs to be updated with new attributes. The controller co

I'm using Authlogic for my authentication system in a Rails 2.3.8 application for a client of mine. I have a model, CommunityEventUser, that needs to be updated with new attributes. The controller code is this:

  def edit开发者_JAVA百科
    @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

It's just standard edit/update RESTful code. When I go to the view for editing the user account information, submitting the form with changes to any attributes besides password and password_confirmation, and leaving those last two fields blank redirects me to a page with this error on:

Template is missing

Missing template community_event_users/edit.erb in view path app/views

And this URL:

http://localhost:3000/events/user.%23%3Ccommunityeventuser:0x10495ad80%3E

However, when I do matching passwords in the two password fields, the user is updated correctly. I thought standard Authlogic use allowed simply ignored blank password and password_confirmation fields on update. What could be the problem here?

View code for edit:

- 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'


Instead of

render :action => :edit

you could use:

render :template => "community_event_users/edit"

So, do you have a file like: "yourapp/views/community_event_users/edit.erb" ?

If not, use the path to your edit-view-file.

0

精彩评论

暂无评论...
验证码 换一张
取 消