radio buttons form in ruby on rails

Hi there!

I m using this form:

<%= form_for(:usage, :url=> {:action =>‘getResults’}) do |f| %>

Select search criteria :

<%= f.radio_button :filter, ‘uni’%> For Unicast only

<%= f.radio_button :filter, ‘multi’ %> For Multicasts only

<%= f.radio_button :filter, ‘month’ %> Current Month

<%= f.radio_button :filter, ‘date’ %> On this date:

<%= f.date_select(:date,:order=>[:day,:month,:year])%>

<%= link_to ‘Search’, {:action=>“getResults”}, :remote => true, :submit%>

<% end %>

and in controller I have:

def getResults

if params[:filter] == 'uni'

@results = Multicasts.where(:sms_voice => ‘sms’)


if params[:filter] ==‘multi’

@results = Multicasts.where(:when => ‘im’)


if params[:filter] ==‘month’

@results = Multicasts.where(‘extract(month from datetime) = ?’, MONTH(date))


render :new_results


Is this a correct way to read info from radio buttons.

Please help, it is not working. Is the syntax correct?

It's horrible markup and very un-Ruby/Rails-ish code, but the key
point is: what EXACTLY do you mean by "not working"?

Is your controller getting the params you expect or not? Is the value
of @results not what you expect for a given input?

What is the problem?