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 --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Thu, Jun 18, 2009 at 3:17 PM, Rachel Nichol<rachel.nichol-uVpXp7NhOuKQXGs3P2Bq9w@public.gmane.org> wrote:> 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
2009/6/18 Rachel Nichol <rachel.nichol-uVpXp7NhOuKQXGs3P2Bq9w@public.gmane.org>:> 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?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
Yes.  Thank you.
I have ... 
<% @list_web_serv_cats.each do |category| %>
  <!-- some html stuff here -->
  <% form_tag({:controller => ''customers'', :action =>
''list_services_available_at_location'',
:wsc_uid=>category[''wsc_uid_pk'']}) do %>
   <%= category[''wsc_uid_pk''] %> <!-- printing to
view to verify data exists -->
   <%= select_tag(:wsc_uid, ''<option value="">Select
Type</option>'' +
options_for_select(@list_web_serv_types.collect{|servtype|
[servtype[''wbt_description''].to_s,
servtype[''wbt_uid_pk''].to_i]}, params[:id].to_i)) %>
<!-- @list_web_serv_types uses param[:wsc_uid] to bring data from model/db
package call -->
   <% @list_web_serv_types.each do |servtype| %>
      <tr><td height="25px" align="left"
valign="top" > <%= servtype[''wbt_uid_pk'']
%> <%= servtype[''wbt_description''] %>
</td></tr>
   <% end %> <!-- @list_web_serv_types.each end -->
 <% end %> <!-- form_tag end -->
 </td>  
 <!-- next column: service category subtypes -->
 </tr>
<% end %> <!-- @list_web_serv_cats.each end -->
Thank you,
Rachel S Nichol
W: (843) 686-1223 
F: (843) 341-0980
 
Hargray''s mission:  To envision and deliver customer delight
-----Original Message-----
From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
[mailto:rubyonrails-talk@googlegroups.com] On Behalf Of Andrew Timberlake
Sent: Thursday, June 18, 2009 9:29 AM
To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: [Rails] Re: Param in View not being set
On Thu, Jun 18, 2009 at 3:17 PM, Rachel
Nichol<rachel.nichol-uVpXp7NhOuKQXGs3P2Bq9w@public.gmane.org>
wrote:> 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
On Jun 18, 2:17 pm, "Rachel Nichol" <rachel.nic...-uVpXp7NhOuKQXGs3P2Bq9w@public.gmane.org> wrote:> 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? >What is category[''wsc_uid_pk''] ? You can''t pass arbitrary objects through a link like that. Fred> Thank you, > > Rachel S Nichol > Oracle Developer > Hargray Telephone Company
On Thu, Jun 18, 2009 at 3:38 PM, Rachel Nichol<rachel.nichol-uVpXp7NhOuKQXGs3P2Bq9w@public.gmane.org> wrote:> > Yes. Thank you. > > I have ... > > <% @list_web_serv_cats.each do |category| %> > <!-- some html stuff here --> > <% form_tag({:controller => ''customers'', :action => ''list_services_available_at_location'', :wsc_uid=>category[''wsc_uid_pk'']}) do %> > > <%= category[''wsc_uid_pk''] %> <!-- printing to view to verify data exists --> > > <%= select_tag(:wsc_uid, ''<option value="">Select Type</option>'' + options_for_select(@list_web_serv_types.collect{|servtype| [servtype[''wbt_description''].to_s, servtype[''wbt_uid_pk''].to_i]}, params[:id].to_i)) %> > <!-- @list_web_serv_types uses param[:wsc_uid] to bring data from model/db package call --> > <% @list_web_serv_types.each do |servtype| %> > <tr><td height="25px" align="left" valign="top" > <%= servtype[''wbt_uid_pk''] %> <%= servtype[''wbt_description''] %> </td></tr> > <% end %> <!-- @list_web_serv_types.each end --> > <% end %> <!-- form_tag end --> > </td> > <!-- next column: service category subtypes --> > </tr> > <% end %> <!-- @list_web_serv_cats.each end --> > > Thank you, > Rachel S Nichol > W: (843) 686-1223 > F: (843) 341-0980 >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''] %> ... Andrew Timberlake http://ramblingsonrails.com http://MyMvelope.com - The SIMPLE way to manage your savings
Sorry I did not provide more details.  Another email has been sent with code
snippet from view (and included below).  Please pardon my incompleteness as I am
very new to this type of development.
Is it okay to use a hidden field?  I have seen talk of hidden fields in my
Google searches but do not understand how to use it, but then, I have been
focused on just assigning to the parameter.  So, I will Google some more on
hidden field and focus on how that is done.
I have ... 
<% @list_web_serv_cats.each do |category| %>
  <!-- some html stuff here -->
  <% form_tag({:controller => ''customers'', :action =>
''list_services_available_at_location'',
:wsc_uid=>category[''wsc_uid_pk'']}) do %>
   <%= category[''wsc_uid_pk''] %> <!-- printing to
view to verify data exists -->
   <%= select_tag(:wsc_uid, ''<option value="">Select
Type</option>'' +
options_for_select(@list_web_serv_types.collect{|servtype|
[servtype[''wbt_description''].to_s,
servtype[''wbt_uid_pk''].to_i]}, params[:id].to_i)) %>
<!-- @list_web_serv_types uses param[:wsc_uid] to bring data from model/db
package call -->
   <% @list_web_serv_types.each do |servtype| %>
      <tr><td height="25px" align="left"
valign="top" > <%= servtype[''wbt_uid_pk'']
%> <%= servtype[''wbt_description''] %>
</td></tr>
   <% end %> <!-- @list_web_serv_types.each end -->  <% end %>
<!-- form_tag end -->  </td>
 <!-- next column: service category subtypes -->  </tr> <% end
%> <!-- @list_web_serv_cats.each end -->
Thank you,
Rachel S Nichol
Hargray''s mission:  To envision and deliver customer delight
-----Original Message-----
From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
[mailto:rubyonrails-talk@googlegroups.com] On Behalf Of Colin Law
Sent: Thursday, June 18, 2009 9:33 AM
To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: [Rails] Re: Param in View not being set
2009/6/18 Rachel Nichol
<rachel.nichol-uVpXp7NhOuKQXGs3P2Bq9w@public.gmane.org>:> 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?
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
2009/6/18 Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > > > On Jun 18, 2:17 pm, "Rachel Nichol" <rachel.nic...-uVpXp7NhOuKQXGs3P2Bq9w@public.gmane.org> > wrote: >> 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? >> > > What is category[''wsc_uid_pk''] ? You can''t pass arbitrary objects > through a link like that. > > FredAlso 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
Wow! I ran the w3c html validator and have many errors (just as you detected). Am in process of correcting those now. Thank you so much. I had no idea a tool like this existed. Thank you, Rachel S Nichol W: (843) 686-1223 F: (843) 341-0980 Hargray''s mission: To envision and deliver customer delight -----Original Message----- From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-talk@googlegroups.com] On Behalf Of Colin Law Sent: Thursday, June 18, 2009 9:50 AM To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Subject: [Rails] Re: Param in View not being set 2009/6/18 Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > > > On Jun 18, 2:17 pm, "Rachel Nichol" <rachel.nic...-uVpXp7NhOuKQXGs3P2Bq9w@public.gmane.org> > wrote: >> 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? >> > > What is category[''wsc_uid_pk''] ? You can''t pass arbitrary objects > through a link like that. > > FredAlso 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
Hello All,
I have been working on dynamically filling the drop box some more and got it to
work -- if I call the model directly from the view (code snippet below <%=
select("wsc_uid"...)...).
Now, I know this is not correct.  I resorted to doing it this way because when
trying to pass category[''wsc_uid_pk''] to the controller, via a
param, a nil value is being passed - even though I can clearly see there is data
for category[''wsc_uid_pk''].
I tried Andrew''s suggestion for hidden field tag but to no avail... the
controller was still not seeing the data.
Can anyone please give me an idea of what I need to do to get this to work
correctly between View - Controller - Model?
Code Snippet from View:
-----------------------
<% @list_web_serv_cats.each do |category| %>
  <tr><td height="25px" align="left"
valign="top" > <%= category[''wsc_description'']
%></td>
  <!-- added back below check box for html cleanup -->
  <td height="25px" align="left" valign="top"
style="display: inline;" ></td>
  <!-- service category types -->
  <!-- insert code here to dynamically fill the drop box from database based
on category primary key -->
  <td height="25px" align="left"  valign="top"
style="display: inline;" >
    <!-- this works but it is not correct.  i should be passing
category[''wsc_uid_pk''] to controller and using controller to
call model... -->
    <%=
select("wsc_uid"+category[''wsc_uid_pk''].to_s,
"id",
Customer.list_web_serv_types(category[''wsc_uid_pk'']).map {|u|
[u[''wbt_description''], u[''wbt_uid_pk'']]})
%>
    <!-- this works but it is not correct.  i should be passing
category[''wsc_uid_pk''] to controller and using controller to
call model... -->
  </td>
  </tr>
  <!-- next column: service category subtypes -->
<% end %>
Code Snippet from Model:
------------------------
def self.list_web_serv_types(wsc_uid_pk) # should be called from customers
controller
  ActiveRecord::Base.connection.select("SELECT gdt_number1 wbt_uid_pk,
                                               gdt_number2
wbt_web_serv_cats_uid_fk,
                                               gdt_alpha1  wbt_code,
                                               gdt_alpha2  wbt_description
                                          FROM TABLE
(service_availability_web_pkg.fn_get_web_service_type(#{wsc_uid_pk}))")
end
Thank you,
Rachel S Nichol
 
Hargray''s mission:  To envision and deliver customer delight
-----Original Message-----
From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
[mailto:rubyonrails-talk@googlegroups.com] On Behalf Of Andrew Timberlake
Sent: Thursday, June 18, 2009 9:45 AM
To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: [Rails] Re: Param in View not being set
On Thu, Jun 18, 2009 at 3:38 PM, Rachel
Nichol<rachel.nichol-uVpXp7NhOuKQXGs3P2Bq9w@public.gmane.org>
wrote:>
> Yes.  Thank you.
>
> I have ...
>
> <% @list_web_serv_cats.each do |category| %>
>  <!-- some html stuff here -->
>  <% form_tag({:controller => ''customers'', :action
=> ''list_services_available_at_location'',
:wsc_uid=>category[''wsc_uid_pk'']}) do %>
>
>   <%= category[''wsc_uid_pk''] %> <!-- printing to
view to verify data exists -->
>
>   <%= select_tag(:wsc_uid, ''<option
value="">Select Type</option>'' +
options_for_select(@list_web_serv_types.collect{|servtype|
[servtype[''wbt_description''].to_s,
servtype[''wbt_uid_pk''].to_i]}, params[:id].to_i)) %>
> <!-- @list_web_serv_types uses param[:wsc_uid] to bring data from
model/db package call -->
>   <% @list_web_serv_types.each do |servtype| %>
>      <tr><td height="25px" align="left"
valign="top" > <%= servtype[''wbt_uid_pk'']
%> <%= servtype[''wbt_description''] %>
</td></tr>
>   <% end %> <!-- @list_web_serv_types.each end -->
>  <% end %> <!-- form_tag end -->
>  </td>
>  <!-- next column: service category subtypes -->
>  </tr>
> <% end %> <!-- @list_web_serv_cats.each end -->
>
> Thank you,
> Rachel S Nichol
> W: (843) 686-1223
> F: (843) 341-0980
>
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''] %>
...
Andrew Timberlake
http://ramblingsonrails.com
http://MyMvelope.com - The SIMPLE way to manage your savings
Is there anyone in this group that can give me a pointer on this?  
Thank you,
Rachel S Nichol
 
Hargray''s mission:  To envision and deliver customer delight
-----Original Message-----
From: Rachel Nichol 
Sent: Thursday, June 25, 2009 9:09 AM
To: ''rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org''
Subject: RE: [Rails] Re: Param in View not being set
Hello All,
I have been working on dynamically filling the drop box some more and got it to
work -- if I call the model directly from the view (code snippet below <%=
select("wsc_uid"...)...).
Now, I know this is not correct.  I resorted to doing it this way because when
trying to pass category[''wsc_uid_pk''] to the controller, via a
param, a nil value is being passed - even though I can clearly see there is data
for category[''wsc_uid_pk''].
I tried Andrew''s suggestion for hidden field tag but to no avail... the
controller was still not seeing the data.
Can anyone please give me an idea of what I need to do to get this to work
correctly between View - Controller - Model?
Code Snippet from View:
-----------------------
<% @list_web_serv_cats.each do |category| %>
  <tr><td height="25px" align="left"
valign="top" > <%= category[''wsc_description'']
%></td>
  <!-- added back below check box for html cleanup -->
  <td height="25px" align="left" valign="top"
style="display: inline;" ></td>
  <!-- service category types -->
  <!-- insert code here to dynamically fill the drop box from database based
on category primary key -->
  <td height="25px" align="left"  valign="top"
style="display: inline;" >
    <!-- this works but it is not correct.  i should be passing
category[''wsc_uid_pk''] to controller and using controller to
call model... -->
    <%=
select("wsc_uid"+category[''wsc_uid_pk''].to_s,
"id",
Customer.list_web_serv_types(category[''wsc_uid_pk'']).map {|u|
[u[''wbt_description''], u[''wbt_uid_pk'']]})
%>
    <!-- this works but it is not correct.  i should be passing
category[''wsc_uid_pk''] to controller and using controller to
call model... -->
  </td>
  </tr>
  <!-- next column: service category subtypes -->
<% end %>
Code Snippet from Model:
------------------------
def self.list_web_serv_types(wsc_uid_pk) # should be called from customers
controller
  ActiveRecord::Base.connection.select("SELECT gdt_number1 wbt_uid_pk,
                                               gdt_number2
wbt_web_serv_cats_uid_fk,
                                               gdt_alpha1  wbt_code,
                                               gdt_alpha2  wbt_description
                                          FROM TABLE
(service_availability_web_pkg.fn_get_web_service_type(#{wsc_uid_pk}))")
end
Thank you,
Rachel S Nichol
 
Hargray''s mission:  To envision and deliver customer delight
-----Original Message-----
From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
[mailto:rubyonrails-talk@googlegroups.com] On Behalf Of Andrew Timberlake
Sent: Thursday, June 18, 2009 9:45 AM
To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: [Rails] Re: Param in View not being set
On Thu, Jun 18, 2009 at 3:38 PM, Rachel
Nichol<rachel.nichol-uVpXp7NhOuKQXGs3P2Bq9w@public.gmane.org>
wrote:>
> Yes.  Thank you.
>
> I have ...
>
> <% @list_web_serv_cats.each do |category| %>
>  <!-- some html stuff here -->
>  <% form_tag({:controller => ''customers'', :action
=> ''list_services_available_at_location'',
:wsc_uid=>category[''wsc_uid_pk'']}) do %>
>
>   <%= category[''wsc_uid_pk''] %> <!-- printing to
view to verify data exists -->
>
>   <%= select_tag(:wsc_uid, ''<option
value="">Select Type</option>'' +
options_for_select(@list_web_serv_types.collect{|servtype|
[servtype[''wbt_description''].to_s,
servtype[''wbt_uid_pk''].to_i]}, params[:id].to_i)) %>
> <!-- @list_web_serv_types uses param[:wsc_uid] to bring data from
model/db package call -->
>   <% @list_web_serv_types.each do |servtype| %>
>      <tr><td height="25px" align="left"
valign="top" > <%= servtype[''wbt_uid_pk'']
%> <%= servtype[''wbt_description''] %>
</td></tr>
>   <% end %> <!-- @list_web_serv_types.each end -->
>  <% end %> <!-- form_tag end -->
>  </td>
>  <!-- next column: service category subtypes -->
>  </tr>
> <% end %> <!-- @list_web_serv_cats.each end -->
>
> Thank you,
> Rachel S Nichol
> W: (843) 686-1223
> F: (843) 341-0980
>
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''] %>
...
Andrew Timberlake
http://ramblingsonrails.com
http://MyMvelope.com - The SIMPLE way to manage your savings
2009/6/26 Rachel Nichol <rachel.nichol-uVpXp7NhOuKQXGs3P2Bq9w@public.gmane.org>:> > <!-- this works but it is not correct. i should be passing category[''wsc_uid_pk''] to controller and using controller to call model... --> > <%= select("wsc_uid"+category[''wsc_uid_pk''].to_s, "id", Customer.list_web_serv_types(category[''wsc_uid_pk'']).map {|u| [u[''wbt_description''], u[''wbt_uid_pk'']]}) %> > <!-- this works but it is not correct. i should be passing category[''wsc_uid_pk''] to controller and using controller to call model... -->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
Thank you so much Colin. I really thought calling the model method from the view was not acceptable. I appreciate your input on this as I am still learning the framework and proper techniques. Thank you, Rachel S Nichol W: (843) 686-1223 F: (843) 341-0980 Hargray''s mission: To envision and deliver customer delight -----Original Message----- From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-talk@googlegroups.com] On Behalf Of Colin Law Sent: Friday, June 26, 2009 8:59 AM To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Subject: [Rails] Re: Param in View not being set 2009/6/26 Rachel Nichol <rachel.nichol-uVpXp7NhOuKQXGs3P2Bq9w@public.gmane.org>:> > <!-- this works but it is not correct. i should be passing category[''wsc_uid_pk''] to controller and using controller to call model... --> > <%= select("wsc_uid"+category[''wsc_uid_pk''].to_s, "id", Customer.list_web_serv_types(category[''wsc_uid_pk'']).map {|u| [u[''wbt_description''], u[''wbt_uid_pk'']]}) %> > <!-- this works but it is not correct. i should be passing category[''wsc_uid_pk''] to controller and using controller to call model... -->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