Skip to content

Fix issue#265 #266

Merged
merged 1 commit into from Sep 1, 2012
View
8 lib/kaminari/helpers/action_view_extension.rb
@@ -86,12 +86,10 @@ def link_to_next_page(scope, name, options = {}, &block)
# <%= page_entries_info @posts, :entry_name => 'item' %>
# #-> Displaying items 6 - 10 of 26 in total
def page_entries_info(collection, options = {})
- entry_name = options[:entry_name] || (collection.empty? ? 'entry' : collection.first.class.name.underscore.sub('_', ' '))
-
- entry_name = if collection.empty?
- 'entry'
- elsif options[:entry_name]
+ entry_name = if options[:entry_name]
options[:entry_name]
+ elsif collection.empty?
+ 'entry'
else
if collection.respond_to? :model # DataMapper
collection.model.model_name.human.downcase
View
5 spec/helpers/action_view_extension_spec.rb
@@ -78,6 +78,11 @@
context 'having no entries' do
subject { helper.page_entries_info @users, :params => {:controller => 'users', :action => 'index'} }
it { should == 'No entries found' }
+
+ context 'setting the entry name option to "member"' do
+ subject { helper.page_entries_info @users, :entry_name => 'member', :params => {:controller => 'users', :action => 'index'} }
+ it { should == 'No members found' }
+ end
end
context 'having 1 entry' do
Something went wrong with that request. Please try again.