Hi, was tryin to do a restful method to allow users to change
password.
This is what i did:
-
use restful authentication plugin.
-
use the code here
http://www.railslodge.com/plugins/75-restful-authentication/documentations/1-change-password -
realise that
no1. i am using something funny like /v1/users/:permalink/
change_password and not just /change_password
no2. i cant use html.erb for some reasons hence i resorted to
using .rhtml
- end up re writing the view code as such:
Old Password <%= password_field_tag 'old_password', @old_password, :size => 45, :class => 'text' %> |
New Password <%= password_field_tag 'password', {}, :size => 45, :class => 'text' %> Between 4 and 40 characters |
Confirm new password <%= password_field_tag 'password_confirmation', {}, :size => 45, :class => 'text' %> |
<%= submit_tag ‘Change password’ %>
<%end%>
wrote my routes.rb
base = ‘/v1’
map.resources :users, :path_prefix => base, :member =>
{:change_password => :get, :change_password_update => :put} do |users|
users.resources :orders, :path_prefix => ‘/v1/users/:permalink’
end
- got this error when i tried to attempt to change my password and
press the submit button
no route found to match “/v1/users/testuser1/change_password” with
{:method=>:post}
why is it that after submitting the form, i will trigger a POST to
change_password_user_path?
please advise