Need help to format the result page after searching
Posted
by kshama
on Stack Overflow
See other posts from Stack Overflow
or by kshama
Published on 2010-04-26T00:10:28Z
Indexed on
2010/04/26
0:13 UTC
Read the original article
Hit count: 217
Hi, I have built a small text based search engine on ROR which will display relevant records having a specified search word in it.since few of the records has more than 1000 words i have truncated each result set to 200 characters.My views file search.html.erb looks like this
<% @results_with_ranks.each do |result| -%>
<% content_id = rtable.find(result[0]).content_id %>
<% content= Content.find(content_id) %>
<%= truncate content.body, :length => 200 %><br/>
<p> Record id <%= content.id %></p>
<hr style="color:blue">
<% end -%>
I want to provide an option so that whenever any truncated record is selected its entire body has to be displayed. I also want to paginate the result page displaying some fixed number of records per page.Can any body help me in doing this? Thanks in advance.
© Stack Overflow or respective owner