rails3 will_paginate hash object
问题 Looks like will_paginate dosen't support paginating a hash object. I have a list of articles which is basically a collection of yaml files that i want to output on a page. def index @articles = Dir["#{Rails.root}/blog_articles/*.yml"].inject({}) do |h, file| h["#{File.basename(file, '.yml')}"] = YAML::load(File.open(file)) h end end Can anyone suggest me on how to write the pagination for this? Thanks. 回答1: In your controller: def index @articles = Dir["#{Rails.root}/blog_articles/*.yml"]