To render or redirect

Hi guys,

I have been using this code for a while and on the whole it works well.

Display the search page

def search
@breadcrumb_title = ‘Search’
if request.get?
@home_search =
@home_search =[:home_search])
@search_conditions = Home.search_homes(params).to_sql
if @home_search.valid?
@homes = Home.find(:all, :conditions=> (@search_conditions))
if @homes.empty?
flash_message ‘Your search has returned no results. Please
revise your search critera.’
render :action => ‘search’
@record_count = Home.count(@search_conditions)
render :action => ‘search_results’
render :action => ‘search’

There is just one little problem that my users are complaining about.
They fill in the search form and hit enter and hey presto the results
are displayed. The only problem is that if they hit the browser back
button, it returns to an empty search screen. What I need to do is go
back to the search screen containing the information they have already
entered, so that they can alter.

I think my problem is I use render rather than redirect_to. I have been
trying to use redirect_to and trying to pass in the @homes variable, but
no dice. I have no doubt missed something blinding obvious. Any ideas?

Thanks in advance for any help

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs