Created
December 26, 2008 23:53
-
-
Save thbar/40159 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_record' | |
require 'action_view' | |
require 'will_paginate' | |
WillPaginate.enable | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def items(page) | |
@current_page = page.to_i | |
@items = Item.paginate :page => @current_page, :order => 'id DESC', :per_page => 10 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#{will_paginate @items, :param_name => :items, :class => 'pagination' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Ramaze | |
module Helper | |
module WillPaginateForRamaze | |
include ActionView::Helpers::UrlHelper | |
include ActionView::Helpers::TagHelper | |
include WillPaginate::ViewHelpers | |
def url_for(args) | |
url = case args | |
when Hash; | |
resource = args.keys.first | |
page_number = args[resource] | |
hash_url = "/#{resource}" | |
hash_url << "/#{page_number}" unless page_number == 1 | |
hash_url | |
when String; | |
args | |
end | |
end | |
def params | |
request.params | |
end | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment