The urls are not correct: http://www.met.rdg.ac.uk/users/users/1222/edit
Earlier I suggested that you look at the html rendered by your templates (view source in your browser or firebug). For whatever reason the action on your forms is not correct.
The urls are not correct: http://www.met.rdg.ac.uk/users/users/1222/edit
Earlier I suggested that you look at the html rendered by your templates (view source in your browser or firebug). For whatever reason the action on your forms is not correct.
The edit action should be posting to the update action, not index
action.
Check the html output for your edit page. The form tag should look
something like this:
<form action="/users/1222" class="edit_user" id="edit_user_1222"
method="post">
Michael Breen wrote:
The edit action should be posting to the update action, not index action.
Check the html output for your edit page. The form tag should look something like this:
<form action="/users/1222" class="edit_user" id="edit_user_1222" method="post">
Interesting, the page source seems to have left the ID out so I'm getting
<form action="/users/users/" class="edit_user" id="edit_user" method="post">
instead of <form action="/users/1222" class="edit_user" id="edit_user_1222" method="post">
Shouldn't
<% form_for(@user) do |f| %>
<%= f.submit "Save" %>
<% End %>
do this automatically?
perhaps somebody can post an example ActionController that works along with an example routes.rb file/correct urls so I can figure out my next step?
Most of the tutorials for this stuff seem to be for rails 1.2
create a dummy project and then run script/generate scaffold User
first_name:string last_name:string
that will give you a good example RESTful controller. easier than
someone posting that code.
Michael Breen wrote:
create a dummy project and then run script/generate scaffold User first_name:string last_name:string
that will give you a good example RESTful controller. easier than someone posting that code.
This is getting weird now. I've done the following
rails testproj script/generate scaffold user ForeName:string SurName:string
and the generated UsersController code for update and delete is identical to what I have for my user project, and the only difference inthe routes.rb file is the line, map.root :controller => "users"
I'm kind of at a loss
If my database was not allowing update access it rails would throw an exception wouldn't it?