Method: EffectivePostsHelper#effective_post_category_path

Defined in:
app/helpers/effective_posts_helper.rb

#effective_post_category_path(category, opts = nil) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'app/helpers/effective_posts_helper.rb', line 46

def (category, opts = nil)
  return effective_posts.posts_path(opts || {}) unless category.present?

  category = category.to_s
  category_path = category.to_s.downcase.parameterize
  opts = (opts || {}).compact
  query = ('?' + opts.to_query) if opts.present?

  if EffectivePosts.use_blog_routes
    "/blog/category/#{category_path}#{query}"
  elsif EffectivePosts.use_category_routes
    "/#{category_path}#{query}"
  else
    effective_posts.posts_path(opts.merge(category: category.presence).compact)
  end
end