Class: Integral::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
Pundit
Defined in:
app/controllers/integral/application_controller.rb

Overview

Base Frontend controller

Instance Method Summary collapse

Instance Method Details

#category_path(category) ⇒ String

Returns path to category page.

Returns:

  • (String)

    path to category page



24
25
26
27
28
29
30
# File 'app/controllers/integral/application_controller.rb', line 24

def category_path(category)
  if Integral.multilingual_frontend?
    "/#{I18n.locale}/#{Integral.blog_namespace}/#{category.slug}"
  else
    "/#{Integral.blog_namespace}/#{category.slug}"
  end
end

#render(*args, &block) ⇒ Object

Override added as workaround for before_render Rails 5 incompatibility



16
17
18
19
# File 'app/controllers/integral/application_controller.rb', line 16

def render(*args, &block)
  before_render
  super
end

#validate_routed_through_aliasObject

Raises:

  • (ActionController::RoutingError)


11
12
13
# File 'app/controllers/integral/application_controller.rb', line 11

def validate_routed_through_alias
  raise ActionController::RoutingError, 'Resource cannot be directly accessed' unless params[:integral_original_path].present?
end