学习笔记: paginate

script/plugin install svn://errtheblog.com/svn/plugins/will_paginate 


Model -> Controller
http://hideto.iteye.com/blog/108118

Ajax
http://www.letrails.cn/archives/07-10-25-ajax-will-paginate

def will_paginate_remote(paginator, options={})
  update = options.delete(:update)
  url = options.delete(:url)
  str = will_paginate(paginator, options)
  if str != nil
    str.gsub(/href="(.*?)"/) do
      "href=\"#\" onclick=\"new Ajax.Updater('" + update + "', '" + (url ? url + $1.sub(/[^\?]*/, '') : $1) +
      "', {asynchronous:true, evalScripts:true, method:'get',}); return false;\""
    end
  end
end


will_paginate_remote(feeds, :param_name => 'feed_page', :update=>'feed-list', :url=>"/feeds/list")

你可能感兴趣的:(Ajax,SVN,Blog,Ruby)