Helper in controller?

Hello,

I have have written a statictics controller for one of my applications -
and I want to allow users to pull out certain statistics from a certain
period.

In my view, I’ve added something like this:

[view]
<%= form_tag :action => “bu” %>

Germany


From: <%= select_date(date = Date.today, :prefix => ‘from’) %>

To:<%= select_date(date = Date.today, :prefix => ‘to’) %>
<%= submit_tag ‘BU stat’ %>


<%= end_form_tag %>

Now, to be able to build the select query in my controller, I’ve done
like this:
if request.post?
from = params[:from][:year] + ‘-’ + params[:from][:month] + ‘-’ +
params[:from][:day]
to = params[:to][:year] + ‘-’ + params[:to][:month] + ‘-’ +
params[:to][:day]
@lines = Line.find(:all, :conditions => ["projects.bu like ? and
(projects.created_at BETWEEN ? AND ?) ", “#{@params[:bu]}%”,
from.to_date, to.to_date], :include => [:project]
end

It all works, but it is not pretty. I wanted to hear if anybody would
have a suggestion of how to do this the right way ?
If this is the only way, I’d also like to hear if it is possible to
write a helper (for the controller) to the from and to variables from
all the params[] so I do not have to create these lines for each action
that requires from- and to-dates.

/mich