The question is about passing data from action of one controller to
action of another controller.
Inside the new_patient_controller i have the following code when the
button “next” is clicked
def create_visit (created_patient)
redirect_to(:controller=>“patient_visit”,:action=>“index”,:created_patient=>created_patient)
end
This is suppose to call the index view of the “patient_visit” controller
.
Now the “patient_visit” controller has the following form
- <% form_for :patient_visit , :url => { :action =>
:save_patient_visit } do |form| %> -
<p>
-
<%= label :patient_visit , :complaints , "Complaints:" %>
-
<%= form.text_area :complaints , :size => 20 %>
-
</p>
-
<p>
-
<%= label :patient_visit , :systemic_history , "Systemic
History:" %>
10. <%= form.text_field :systemic_history , :size => 40 %>
11.
12.
13.
14. <%= label :patient_visit , :opthal_history , “Opthal
History:” %>
15. <%= form.text_field :opthal_history , :size => 40 %>
16.
17.
18. <%= submit_tag “next” , :class => “submit” %>
19.
20. <%end%>
Because of this the params which originally had the value of
“created_patient” now gets overwritten with the new params which has the
value of “:patient_visit” .
I need the created_patient value , cause i need to attach the
patient_visit database entry to the created_patient. ( since one patient
has many visits )