Forum: Ruby on Rails redirect_to difficulties

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
4afa9f703da7248c956addd9358cf432?d=identicon&s=25 ne ho (revanche)
on 2007-06-25 22:15
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? :/

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'


4afa9f703da7248c956addd9358cf432?d=identicon&s=25 ne ho (revanche)
on 2007-06-25 22:17
Nevermind. I had the redirect_to up on END more than it should have been
This topic is locked and can not be replied to.