will_paginate problem

E

Edou Suilen

Hi,
I have a problem using paginate: i made the paginate to work, but it
only shows results in the first page, whenever i click on the second or
others it doesnt show results, and i have more then 2 results for that
search.


this is the code

controller:

def searchnome
nome = params[:nome]
@posts = Post.paginate:)all,:conditions => ["name=?",
"#{nome}"],:page => params[:page] ,:per_page => 2 )
end


view :


<% @posts.each do |post| %>
<tr>
<td><a>Name : </a></td>
<td><%=h post.name %></td><br />
<td><a>Title : </a></td>
<td><%=h post.title %></td><br />
<td><a>Content</a></td><br />
<td><%=h post.content %></td><br />
</tr><br />
<% end %>
<br />
<%= will_paginate @posts %>



i am a bit new in ruby, any help is welcome :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top