2011-08-05 6 views
0

私のクライアント用のRails 2.3.8アプリケーションで認証システムにAuthlogicを使用しています。私は新しい属性で更新する必要があるモデル、CommunityEventUserを持っています。コントローラのコードは次のとおりです。ユーザを更新してパスワードを提供しないときにテンプレートが表示されない - Authlogic

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コードです。

Template is missing 

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

:私は、ユーザーのアカウント情報を編集passwordpassword_confirmation以外の任意の属性を変更してフォームを送信し、空白これら最後の2つのフィールドを残しするためのビューに行くときに、このエラーでページに私をリダイレクトしますこのURL:

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

ただし、2つのパスワードフィールドで一致するパスワードを入力すると、ユーザーが正しく更新されます。私は標準Authlogicの使用は、単に更新された空白のフィールドpasswordpassword_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

代わり

render :action => :edit 

のあなたが使用できます。 「yourapp /ビュー:

render :template => "community_event_users/edit" 

だから、あなたのようなファイルを持っています/community_event_users/edit.erb "?

編集しない場合は、編集ビューファイルへのパスを使用します。

+0

正しいディレクトリに 'edit.html.haml'ファイルがあります。 –

+0

だから、 'レンダリングしてみてください可能性があります。テンプレート=>「community_event_users/edit.html.haml' それが欠落しているテンプレートのエラーを削除しない場合は、このエラーがスローされた理由を、私は知りませんが – Deradon

+0

私は、ことを試してみましたそれはうまくいかなかった。 –

関連する問題