hi everybody,
i am new to rails…
plz clear my doubt…
this is my question
In my table(public_topics), i have 11 rows of data…
whenever i run the following view, it shows the entire rows in the
current page…
and i have set the ‘:per_page’ option to ‘2’.so it must show two data
per page…but it shows all the rows in a single page…and this case
continue in all the pagination links…
It seems that pagination is not working…
whenever i click the pagination links,nothing change and the same page
reload again with the same data…
i hope this group will definetely help me to get rid of this simple
problem…
my view and the listing method is given below…
This is my controller/method
def listtopics
@public_topic_pages, @public_topics = paginate(:public_topics,
:per_page=>2)
@public_topics=PublicTopic.find_by_sql(“select * from public_topics
where category=’” + params[:id] + “’” )
end
This is my view
<%= error_messages_for ‘public_topic’ %>
Questions
<% for public_topic in @public_topics %>
<%=link_to "#{public_topic.topic}",:action=>"part" %>
<%= if @public_topic_pages.current.previous link_to "< @public_topic_pages.current.previous } end %> <%= if @public_topic_pages.current.next link_to "Next >>", { :page => @public_topic_pages.current.next } end %>
plz help me…
with regards,
Arun.