How to generate password automatically using authlogic

I have problem , i want to generate password automatically
where can i manipulate :password and :confirm_password in action create

def create
@user = User.new(params[:user])
if @user.save
flash[:notice] = “Registration successful.”
redirect_to root_url
else
render :action => ‘new’
end
end

Have you tried just setting @user.password and
@user.password_confirmation (or equivalent) before the @user.save
part?

–Matt J.

On Sep 23, 10:33 pm, “Thriving K.” [email protected]

Matt J. wrote:

Have you tried just setting @user.password and
@user.password_confirmation (or equivalent) before the @user.save
part?

–Matt J.

On Sep 23, 10:33�pm, “Thriving K.” [email protected]

Thank you, i can fix it now.
i have to put

= f.hidden_field :password,:value=>""
= f.hidden_field :password_confirmation,:value=>""

in form first and then i can type

@[email protected]_confirmation=random_password in controller
before save

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs