Skip to content

Instantly share code, notes, and snippets.

@bullfight
Created June 23, 2011 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bullfight/1043291 to your computer and use it in GitHub Desktop.
Save bullfight/1043291 to your computer and use it in GitHub Desktop.
= render :partial => 'shared/feed_item', :collection => @feed_items
.pagination
= link_to_next_page @feed_items, "More", :remote => true
$("div#microposts .feed-item:last").after(
"<%= escape_javascript(render :partial => 'shared/feed_item',
:collection => @feed_items) %>"
);
class PagesController < ApplicationController
respond_to :js, :html
def home
@title = "Home"
if signed_in?
@micropost = Micropost.new if signed_in?
@feed_items = current_user.feed.page(params[:page]).per(1)
end
respond_with @feed_items
end
end
module PagesHelper
def link_to_next_page(scope, name, options = {}, &block)
params = options.delete(:params) || {}
param_name = options.delete(:param_name) || Kaminari.config.param_name
link_to_unless scope.last_page?, name, params.merge(param_name => (scope.current_page + 1)), options.merge(:rel => 'next') do
block.call if block
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment