Pagination in single public page

I’m trying to show my blog to another logged in user, the blog is
paginated and only present on one page (where everything else is
presented about that specific user).

My problem is that the paginate functio does not check for the next page
of blog posts for that user, instead it links me back to my own
blog-page (preentation index). There the paginate function works, for
example it finds my own blogs on page 2. If I try to read my own blog in
my public page (show) it links me back to my own page (index) again.

The page 2 link shows “/presentation?page=2”, which looks a bit odd, I
thought it should look something like:
“/presentation?login=d.stensson40%currant.se?page=2” since it’s a
specific user with the address:
“/presentation?login=d.stensson40%currant.se” .

Clicking the link to page=2 I get re-routed to “/pres” (index page)

I’m having a hard time wrapping this around my head, what am I doing so
horribly wrong?

#########################################################
Application controller ##################################
#########################################################

def make_presentation_vars
@pages, @posts = paginate(@blog.posts, :per_page => 2)
end

#########################################################
class PresentationController < ApplicationController ####
#########################################################

def show
@hide_edit_links = true
login = params[:login]
@user = User.find_by_login(login)

@logged_in_user = User.find(session[:user]) if logged_in?
if @user
  @blog = @user.blog ||= Blog.new #fulkod
make_presentation_vars
end

end

#########################################################
Presentation/show #######################################
(partial)_blog ##########################################
#########################################################

<% if paginated? %> <% first = @pages.current_page.first_item %> <% last = @pages.current_page.last_item %> <% if first == last %> Post <%= last %> of <% else %> Posts <%= first %>–<%= last %> of <% end %> <% end %> <%= pluralize(@blog.posts.count, "blog post") %>

<%= render :partial => “posts/post”, :collection => @posts %>
<%= “Pages: #{pagination_links(@pages)}” if paginated? %>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs