    # File lib/ramaze/helper/pager.rb, line 338
      def paginate(items, options = {})
        limit = options.delete(:limit) || Pager.trait[:limit]
        pager_key = options.delete(:pager_key) || Pager.trait[:key]

        case items
        when Array
          pager = Pager.new(request, limit, items.size, pager_key)
          items = items.slice(pager.offset, pager.limit[:limit])
          return items, pager
        end

        if defined?(Og) && items.is_a?(Og::Collection)
          pager = Pager.new(request, limit, items.count, pager_key)
          options.update(pager.limit)
          items = items.reload(options)
          return items, pager
        elsif defined?(Og::EntityMixin) && items.is_a?(Og::EntityMixin) ||
              defined?(Og::Mixin) && items.is_a?(Og::Mixin) # Og <= 0.41
          pager = Pager.new(request, limit, items.count(options), pager_key)
          options.update(pager.limit)
          items = items.all(options)
          return items, pager
        end

        raise "No suitable pagination method for #{items.inspect}"
      end