Hello All,
I have :wsc_uid=>category['wsc_uid_pk'] in my view so that I can use :wsc_uid parameter in my controller to pass to model. In my view I am printing category[‘wsc_uid_pk’] to see if there is data, and there is indeed data. So, why, when running debugger in controller, is params[:wsc_uid] = nil? Does anyone know what I could be doing wrong?
Thank you,
Rachel S Nichol
Oracle
Developer
Hargray
Telephone Company
Where is :wsc_uid=>category['wsc_uid_pk'] in your view
Give us some more context and it may be easier to help
Regards
Andrew Timberlake
http://ramblingsonrails.com
http://MyMvelope.com - The SIMPLE way to manage your savings
To get a parameter submitted it should be put in a field (hidden if
necessary) on the form. Assuming you are submitting a form that is.
Alternatively if going via a link it can be put as a parameter to the
link. You need to give us a few more clues as to what you are doing.
We are not telepathic (at least I am not).
Colin
I think you may be coming into trouble because of the use of a query
string element in the form action url as well as the form parameters.
Try
<% form_tag({:controller => 'customers', :action =>
'list_services_available_at_location'}) do %>
<%= hidden_field_tag 'wsc_uid_pk', category['wsc_uid_pk'] %>
...
Also your tr and td tags are all to pot. In addition a form cannot
span part of a table, it must either include the whole table or lie
entirely within one cell.
Paste your page source (from view page source in browser) into w3c
html validator to check that it is valid html.
Colin
There is no reason why you should not call model methods from the
view. To improve the modularity however I would suggest providing a
Customer model method called select_box_values or whatever conveys the
right impression to you when you read the code. This method contains
the code that you have in your select statement. Then instead of your
code Customer.list_......map{....} you just have
Customer.select_box_values. Make sure it always returns something
which will be valid in the view however (even in unusual conditions)
so that you do not need any logic in the view.
If you still wish to move this our of the view then in the controller
which invokes this view put
@select_box_values = Controller.select_box_values
and use @select_box_values in the view.
Colin