Rhtml to controller

Hello

I have big Problem with an function. I want to change the Password for a
User in my Program.

View:

Neues Passwort
<%form_tag :url => {:controller => :admin, :action =>
:changepw_admin} do %>

Bitte alle Felder ausfuellen.














altes
Passwort:
<%= password_field_tag :old_password,
params[:old_password], :size => 30 %>
neues Passwort: <%= password_field_tag :new_password,
params[:new_password], :size => 30 %>
Passwort bestaetigen: <%= password_field_tag
:new_password_confirmation, params[:new_password_confirmation], :size =>
30 %>

<%= submit_tag “Passwort aendern”%>
<% end %>

Controller:
def changepw_admin
@user = User.fignd_by_id(session[:user_id])
@user.reset_pw(params[:new_password])
@user.save
flash[:notice] =“Password fuer #{@user.username} geändert”
redirect_to(:action => “index”)
end

Log:
Processing AdminController#change_admin (for 127.0.0.1 at 2007-06-08
15:37:37) [POST]
Session ID: 2941d2fee48c9a3ed0f73614cbbce94c
Parameters: {“commit”=>“Passwort aendern”,
“url”=>“controlleradminactionchangepw_admin”, “action”=>“change_admin”,
“controller”=>“admin”, “old_password”=>“12345”,
“new_password”=>“er90di”, “new_password_confirmation”=>“er90di”}
e[4;35;1mUser Columns (0.000000)e[0m e[0mSHOW FIELDS FROM userse[0m
e[4;36;1mUser Load (0.000000)e[0m e[0;1mSELECT * FROM users WHERE
(users.id = 1) LIMIT 1e[0m
e[4;35;1mUser Load (0.000000)e[0m e[0mSELECT * FROM users WHERE
(users.id = 1) LIMIT 1e[0m
Rendering within layouts/admin
Rendering admin/change_admin
Completed in 0.07000 (14 reqs/sec) | Rendering: 0.01000 (14%) | DB:
0.00000 (0%) | 200 OK
[http://localhost/admin/change_admin?url=controlleradminactionchangepw_admin]

The Problem is that he never go into the function changepw_admin.

Please can somebody help me to find the error?

Thanks

guest wrote:

Parameters: {“commit”=>“Passwort aendern”,
“url”=>“controlleradminactionchangepw_admin”, “action”=>“change_admin”,
“controller”=>“admin”, “old_password”=>“12345”,
“new_password”=>“er90di”, “new_password_confirmation”=>“er90di”}

Because you are writing it wrong.

<%form_tag :url => {:controller => :admin, :action =>
:changepw_admin} do %>

to

<%form_tag :controller => :admin, :action =>
:changepw_admin" do %>

you should remove the URL symbol

Hello

THANK you. You solve the Problem which stopped me for one week! Now it
works perfect.

Guest

guest wrote:

Hello

THANK you. You solve the Problem which stopped me for one week! Now it
works perfect.

Guest

Always look carefully at your log :smiley:

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