diff --git a/lib/kaminari/helpers/action_view_extension.rb b/lib/kaminari/helpers/action_view_extension.rb index c19dc8b..fbf5de0 100644 --- a/lib/kaminari/helpers/action_view_extension.rb +++ b/lib/kaminari/helpers/action_view_extension.rb @@ -41,7 +41,7 @@ module Kaminari def link_to_next_page(scope, name, options = {}, &block) params = options.delete(:params) || {} param_name = options.delete(:param_name) || Kaminari.config.param_name - link_to_unless scope.last_page?, name, params.merge(param_name => (scope.current_page + 1)), options.merge(:rel => 'next') do + link_to_unless scope.last_page?, name, params.merge(param_name => (scope.current_page + 1)), options.reverse_merge(:rel => 'next') do block.call if block end end diff --git a/spec/helpers/action_view_extension_spec.rb b/spec/helpers/action_view_extension_spec.rb index 3de3731..82def61 100644 --- a/spec/helpers/action_view_extension_spec.rb +++ b/spec/helpers/action_view_extension_spec.rb @@ -24,8 +24,15 @@ describe 'Kaminari::ActionViewExtension' do before do @users = User.page(1) end - subject { helper.link_to_next_page @users, 'More', :params => {:controller => 'users', :action => 'index'} } - it { should be_a String } + context 'the default behaviour' do + subject { helper.link_to_next_page @users, 'More', :params => {:controller => 'users', :action => 'index'} } + it { should be_a String } + it { should match /rel="next"/ } + end + context 'overriding rel=' do + subject { helper.link_to_next_page @users, 'More', :rel => 'external', :params => {:controller => 'users', :action => 'index'} } + it { should match /rel="external"/ } + end end context 'the last page' do before do