I am new to Rails and have a simple problem where I am trying to pass
a parameter from a view to another controller outside the scope...The
model is about a Customer having multiple Prescriptions. The GET
request is : /prescription/list_per_customer/2
This is from the view of Customers :
<%= link_to "Customers Prescription", :action =>
"list_per_customer", :controller => "prescription", :id => @customer.id
%>
This is from the other controller, PrescriptionController :
def index
@referred_customer=params[:id]
end
def list_per_customer
@cust_prescriptions =
Prescription.find_all_by_customer_id(@referred_customer)
redirect_to :action => 'list_per_customer'
end
How can this be done with or without sessions ? Will appreciate very
much if the complete code is provided for these two parts of the code
in Customer->view.rhtml and Prescription->list_per_customer...thx
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.