Displaying 4 results from an estimated 4 matches for "edit_password".
2007 May 03
2
Multiple Update Actions that are Relatively the same
...ctions that are rather identical:
# Put /account/you/update_password
def update_password
@user = current :user
respond_to do |format|
if @user.update_attributes(params[:user])
format.html {redirect_to account_url}
else
format.html {render :action => "edit_password"}
end
end
end
# PUT /account/you
# Update the user object.
def update
@user = current :user
respond_to do |format|
if @user.update_attributes(params[:user])
format.html {redirect_to account_url}
else
format.html {render :action => "...
2014 Mar 25
0
Looking for some glue between Strong Parameters and CanCan
...ams.require(:user).permit!
else
params.require(:user).permit(:password, :password_confirmation)
end
end
Now I want to do this the "Cancan way". My first idea looks strange to me:
def user_params
if can? :edit_all_attributes, User
params.require(:user).permit!
elsif can? :edit_password, User
params.require(:user).permit(:password, :password_confirmation)
end
end
How would you realize the attribute level in Cancan? :edit_all_attributes
and :edit_password scales very badly if more user roles and optional
attributes are involved. It would be nice if allowed attributes are d...
2007 May 23
6
RESTful RESOURCE PARTIAL UPDATE
...w users to edit attributes for the same model
from seperate forms instead of one form, while using the given
scaffolding code and performing model validations. I am using
restful_authentication with the login email password validations
defined.
class users_controller
edit_email
edit_login
edit_password
update_email if update_attr save else render => edit_email
update_login if update_attr save else render => edit_login
update_password @curr_pass = params[:curr+passs] if update_attr
save else render => edit_password
end
i have made routes
edit_email_path
edit_l...
2008 Dec 05
4
Replicating Form Behaviour in Functional Test
...= User.find(params[:id])
respond_to do |format|
if @user.update_attributes(params[:user])
flash[:notice] = ''Password updated.''
format.html { redirect_to(@user) }
format.xml { head :ok }
else
format.html { render :action => "edit_password" }
format.xml { render :xml => @user.errors, :status
=> :unprocessable_entity }
end
end
end
The view: edit_password.html.erb
<%= error_messages_for :user %>
<h3><%= @user.username%></h3>
<% form_for @user, :url => {:id => @user.i...