Redirect_to difficulties

I’ve been working on a create function that takes some information from
the user, compares it against existing records and, based on the results
of that comparison, decides how to act.

There is also the chance that if none of the user records match, the
system does nothing. The user’s new input is not saved, and the user is
just returned to the list page.

Everything works perfectly - including the if and elsif portions.

What is not working is that last: redirect_to :action => ‘list’

If the function cycles through all of the Master records and still has
not found a match, it should redirect back to the list without saving.
Unfortunately, it keeps sending the user to create.rhtml page instead.

Any ideas? :confused:

def create
@contact =[:contact])

Master.find(:all,  :conditions => { :firstname =>

:lastname => @contact.lastname
}).each do |master|

    if (Some Criteria)
           Various actions are in here but omitted.
           redirect_to (:action => 'list', :id => @contact) and


    # If not, does the entry match the Level 2 criteria?
    elsif (Some Criteria)
           Various actions are here, too.
           redirect_to (:action => 'list', :id => @contact) and



redirect_to :action => 'list'



Nevermind. I had the redirect_to up on END more than it should have been