This is my users_controller.rb code:
...
def edit
@user = @current_user
end
def update
@user = @current_user # makes our views "cleaner" and more consistent
if @user.update_attributes(params[:user])
flash[:notice] = "Account settings updated."
redirect_back_or_default account_url
else
render :action => 'edit'
end
end
...
I have the following views/users:
- new.html.erb
- password.html.erb
- profile.html.erb
- show.html.erb
Everytime I try to update my user account settings, the following pops up:
ActionView::MissingTemplate (Missing template users/edit.erb in view path app/views:vendor/plugins/admin_data/app/views):
app/controllers/users_controller.rb:46:in `update'
It’s not the fault of admin_data is you are curious. It’s the controller. What have I done wrong? Thanks.
First, if you want the update action to return to :show, you should change
to
otherwise, it will of course look for edit.html.erb or edit.erb
Second, if you use ‘show’ for letting the user edit his/her information, why do you actually have the :edit action in your controller? If you don’t use it, you should probably remove the following: