def thumbs resources, image_url_method, options = {}, &block
      return unless resources.is_a?(Array) || resources.is_a?(ActiveRecord::Relation)
      options[:span] ||= 4
      options[:slice] ||= 12/options[:span]
      ret = "".html_safe

      resources.each_slice(options[:slice]) do |slice|
        ret += content_tag :ul, :class => "thumbnails" do
          slice.inject("".html_safe) do |sum, resource|
            img_url = resource.send(image_url_method)
            url = options[:url_method] ? resource.send(options[:url_method]) : url_for(resource)
            send_args = resource.is_a?(ActiveRecord::Base) ? [:content_tag_for, :li, resource] : [:content_tag, :li]
            send_args << {:class => "span#{options[:span]}"}
            sum + send(*send_args) do
              if block_given?
                content_tag :div, :class => "thumbnail" do
                  image_tag(img_url) + capture(resource, &block)
                end
              else
                link_to image_tag(img_url), url, :class => "thumbnail"
              end
            end
          end
        end
      end
      ret
    end
def thumbs resources, image_url_method, options = {}, &block
      return unless resources.is_a?(Array) || resources.is_a?(ActiveRecord::Relation)
      options[:span] ||= 4
      options[:slice] ||= 12/options[:span]
      ret = "".html_safe

      resources.each_slice(options[:slice]) do |slice|
        ret += content_tag :ul, :class => "thumbnails" do
          slice.inject("".html_safe) do |sum, resource|
            img_url = resource.send(image_url_method)
            url = options[:url_method] ? resource.send(options[:url_method]) : url_for(resource)
            send_args = resource.is_a?(ActiveRecord::Base) ? [:content_tag_for, :li, resource] : [:content_tag, :li]
            send_args << {:class => "span#{options[:span]}"}
            sum + send(*send_args) do
              if block_given?
                content_tag :div, :class => "thumbnail" do
                  image_tag(img_url) + capture(resource, &block)
                end
              else
                link_to image_tag(img_url), url, :class => "thumbnail"
              end
            end
          end
        end
      end
      ret
    end
Options
 span:: integer between 1..12. Item size.
 slice:: integer between 1..12. Items per slice.
 url_method:: string or symbol. URL method of items, default is resources' RESTful URL.