Module: EffectiveKaminariHelper

Defined in:
app/helpers/effective_kaminari_helper.rb

Overview

This extends the @template.url_for method to work with Kaminari It is only extended on the posts#index method, for minimal pollution

Instance Method Summary collapse

Instance Method Details

#url_for(params) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/effective_kaminari_helper.rb', line 5

def url_for(params)
  if params.kind_of?(Hash) && params[:controller] == 'effective/posts' && params[:action] == 'index'
    params.delete(:page) if params[:page].blank?
    params.delete(:category) if EffectivePosts.use_category_routes
    params = params.except(:action, :controller, :only_path)

    request.path.to_s + (params.present? ? '?' : '') + params.to_param
  else
    super
  end
end