Paul Mucur
4/4/2008 8:30:00 PM
On 4 Apr 2008, at 19:17, Ben Simms wrote:
> I know this is probably completely wrong but I couldn't figure out how
> to use the variable from the form in the query in the controller.
In Rails, variables in forms are stored in the params hash so, in your
case, to get the value of titleinput you would do params[:titleinput].
This would change your controller's search method to the following:
def search
@events = Event.find(:all, :order => 'date DESC',
:conditions => ['title=?', params[:titleinput]])
respond_to do |format|
format.html
format.xml { render :xml => @events }
end
end