Searching problem!

Hi , i have customize function for search text. in controller

CONTROLLER_________________________________________________________________________________

def search

if (query = params[:q] )
      @postjob = Postjob.find(:all, :conditions => ["company_name =

?", query])

 end

VIEW__________________________________________________________________________________

<%= link_to "Post Job" , :action => "new"%>   Employers place new openings    <%= start_form_tag :action=>'search_by_country'%> <%= text_field 'co' ,nil %> <%= submit_tag "Find Country" , :controller => "postjobs" , :action => "serach_by_country"%> <%= end_form_tag%>

Listing jobs by Country

<% else if @postjob !=nil %>

<%= link_to "#{p.country}", :action => 'list', :id => p%>  <%= p.headline.capitalize%>,  <%=p.company_name.capitalize%>

<%end%>
<%else%>

No Match Found ! Try with different keywords.....

<% end %> __________________________________________________________________________________

I can search text and i am getting desired result .Now main thing is
that when i search for blank text box i want to show message

No
Match Found ! Try with different keywords…

or if i enter wrong
key work and search result comes nothing i want to print message no data
found …
i tried lot with different conditions but i am not getting proper result
.

Please help me !

Thanks in advance.
:slight_smile:

On Aug 7, 12:16 pm, Dharmdip R. [email protected]
wrote:

I can search text and i am getting desired result .Now main thing is
that when i search for blank text box i want to show message

No
Match Found ! Try with different keywords…

or if i enter wrong
key work and search result comes nothing i want to print message no data
found …
i tried lot with different conditions but i am not getting proper result
.

@postjob will never be nil. find :all, always returns an array (which
may or may not be empty)

Fred