[Ruby] params question

accessing george george.githinji at gmail.com
Wed May 2 21:30:37 PDT 2007


Hi guys!
Am a newbie in rails so please bear with my ignorance

i have a problem with rendering some results
i have a page that displays some search results. i have prepended a checkbox
to each so that the user can choose a varity of interested results if he
desires to.
This is what is inthe search view


<fo*rm*_tag* :*action=>'selected'* do* %>

<%= submit_tag 'get selected' %>
<% for result* in @results* %>

<tr style="background: <%= cycle("#ccc","")%>;" >

<td><%=check_box_tag "result[]", result.uniquename,checked=*false* %></td>

<%end%>

<%end%>

inthe search controller i have this
*

def* selecte*d*

*@selected_genes*=*params[:result]*

*end
*

and inthe selected.rhtml view i have this:

<%=@selected_genes%>

i expected to get an array of the selected genes unique names displayed
onthe page but instead i get a blank page.



When i check a few results and click select, then go to development log i
find that the parameters parsed are like this

Processing SearchController#selected (for 127.0.0.1 at 2007-05-02 21:11:13)
[POST]
  Session ID: fb1d8bd267d768a11af58ac5e9f96d45
  Parameters: {"result"=>["PFL0030c_NT", "PFL0030c_PR"], "commit"=>"get
selected", "action"=>"selected", "controller"=>"search"}
Rendering  within layouts/search
Rendering search/selected
Completed in 0.07800 (12 reqs/sec) | Rendering: 0.07800 (100%) | DB:
0.00000(0%) | 200 OK [
http://localhost/search/selected]

What could be the problem? maybe am missing a step somewhere or using the
wrong approach.

Thanks

george


More information about the Ruby mailing list