Struggling with this one a little bit. I have two parameter search form, when both fields match it returns the row into @person:
So what i want to happen is render one partial before the search, another one if a person is matched and another one if a record is not found.
Where does this logic go and what can I check against?
def index
if params[:id] && params[:dob]
@person = Person.where("id = ? and dob = ?", params[:id], params[:dob]).first
end
end
In my index.html.haml
-if ! @person.nil
=render :partial => 'found'
-elsif @person.nil
=render :partial => 'not_found'
-else
=render :partial => 'welcome'
Problem is that @person.nil? is always true, whether a search is done or not. Anyone have any ideas what to do? What am I missing?