I made a search-field which shows all hits and highlights the all
words searched for:
def suche
if params[:link][:suchfeld] == "description"
@description = "show"
@highlight = params[:suche]
end
@link_pages, @links paginate :link, :order_by =>
''url'',
:conditions => ["#{params[:link][:suchfeld]} LIKE ?",
"%"+params[:suche]+"%"],
:include => [:member],
:per_page => 3
end
view:
<% if @description %>
<div class="link_initial_description" id="link<%= link.id
%>">
<%= highlight(link.description, @highlight, highlighter =
''<strong
class="highlight">\1</strong>'') %>
</div>
<% else %>
<div class="link_initial_description"
style="display:none"
id="link<%= link.id %>">
<%= link.description %>
</div>
<% end %>
<%= pagination_links(@link_pages) %>
Everything works fine when I get only 1 result page. When I get
more pages and click the pages_link highlighting no longer works.
You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]
WHat can I do?
Thanx
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---