Jack you have a few questions here, one of them is relatively easy to display the data in an uneditable way you can make it disabled
http://www.w3.org/TR/html401/interact/forms.html#h-17.12
*How do I pass the student_id and assignment_id to the form? the system is only going to be used locally, but I will validate everything none the less. – Jack*
Jack, you will need something in your current view that can pass the student_id and assignment_id. like a link_to.
<%= link_to "show me my assignments", {:action => 'show', :controller => "assignments"}, :student_id => student.id, :assignment_id => student.assignment[0].id %>
(note it is probably better to use restful routes, but this shows better what is going on)
what this link to will do is call the show action of the assignments controller. you can get the id's in the controller by calling:
assignment_id = params[:assignment_id]
student_id = params[:student_id]
@student = Student.find(:first, :conditions {:id => student_id})
...
Then in your show.html.erb under /app/views/assignments/ directory you would need to render your form code, something like:
<%= form_for @student, :student ...
There are many many possibilities that I glossed over, the question you're asking is a little bit broad. It may be more helpful to break it into smaller chunks (focus less on the application and more on one single action) and re-ask to the forum members.
You could ask more about:
- Sending data to a controller from a
link
- Finding items in your database from
the controller
- Generating a form from the instance
variables in the controller
- finally disabling text_field in a
form
I would say give what i've suggested a shot (send data from the view to a controller, and then use that data from the controller to render another view), and if you cannot figure out something, try to ask a very focused question about the problem you're having, and you will likely end up with a much better over all product.