Skip to content

Commit

Permalink
Merge pull request #277 from eitoball/possible_fix_for_issue_276
Browse files Browse the repository at this point in the history
Possible fix for issue#276
  • Loading branch information
amatsuda committed Sep 2, 2012
2 parents 5daef8e + cd0ee29 commit 3996dfb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/kaminari/helpers/action_view_extension.rb
Expand Up @@ -88,7 +88,7 @@ def link_to_next_page(scope, name, options = {}, &block)
def page_entries_info(collection, options = {}) def page_entries_info(collection, options = {})
entry_name = if options[:entry_name] entry_name = if options[:entry_name]
options[:entry_name] options[:entry_name]
elsif collection.empty? elsif collection.empty? || collection.is_a?(PaginatableArray)
'entry' 'entry'
else else
if collection.respond_to? :model # DataMapper if collection.respond_to? :model # DataMapper
Expand Down
8 changes: 8 additions & 0 deletions spec/helpers/action_view_extension_spec.rb
Expand Up @@ -214,6 +214,14 @@
end end
end end
end end

context 'on a PaginatableArray' do
before do
@numbers = Kaminari.paginate_array(%w{one two three}).page(1)
end
subject { helper.page_entries_info @numbers }
it { should == 'Displaying <b>all 3</b> entries' }
end
end end


describe '#rel_next_prev_link_tags' do describe '#rel_next_prev_link_tags' do
Expand Down

0 comments on commit 3996dfb

Please sign in to comment.