Module: ActiveRecord::Acts::Taggable::SingletonMethods
- Defined in:
- vendor/plugins/blacklight/lib/taggable_pagination.rb
Instance Method Summary (collapse)
Instance Method Details
- (Object) paginate_by_tag(tag, options = {}, find_options = {})
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'vendor/plugins/blacklight/lib/taggable_pagination.rb', line 14 def paginate_by_tag(tag, = {}, = {}) page, per_page, total = ()#WillPaginate::Finder::ClassMethods.send(:wp_parse_options, options) offset = (page.to_i - 1) * per_page .merge!(:offset => offset, :limit => per_page.to_i) items = tag ? find_tagged_with(tag, ) : paginate() .delete :page .delete :per_page count = tag ? tagging_counts(tag) : self.count() returning WillPaginate::Collection.new(page, per_page, count) do |p| p.replace items end end |
- (Object) tagging_counts(tag)
10 11 12 |
# File 'vendor/plugins/blacklight/lib/taggable_pagination.rb', line 10 def tagging_counts(tag) count_by_sql("select count(*) FROM tags, taggings WHERE " + sanitize_sql(['tags.name = ? AND tags.id = taggings.tag_id AND taggings.taggable_type = ?', tag, name])) end |