Skip to content

Commit

Permalink
change #page_entries_info to use model name when collection is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
eitoball committed Aug 8, 2013
1 parent 3f08b7d commit e4cd9a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/kaminari/helpers/action_view_extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def link_to_next_page(scope, name, options = {}, &block)
def page_entries_info(collection, options = {})
entry_name = if options[:entry_name]
options[:entry_name]
elsif collection.empty? || collection.is_a?(::Kaminari::PaginatableArray)
elsif collection.is_a?(::Kaminari::PaginatableArray)
'entry'
else
if collection.respond_to? :model # DataMapper
Expand Down
4 changes: 2 additions & 2 deletions spec/helpers/action_view_extension_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
end
context 'having no entries' do
subject { helper.page_entries_info @users, :params => {:controller => 'users', :action => 'index'} }
it { should == 'No entries found' }
it { should == 'No users found' }

context 'setting the entry name option to "member"' do
subject { helper.page_entries_info @users, :entry_name => 'member', :params => {:controller => 'users', :action => 'index'} }
Expand Down Expand Up @@ -151,7 +151,7 @@
end
context 'having no entries' do
subject { helper.page_entries_info @addresses, :params => {:controller => 'addresses', :action => 'index'} }
it { should == 'No entries found' }
it { should == 'No addresses found' }
end

context 'having 1 entry' do
Expand Down

0 comments on commit e4cd9a6

Please sign in to comment.