Class: Goldencobra::ApplicationController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/goldencobra/application_controller.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object (private)

Catcher for undefined Goldencobra Callback Hooks



50
51
52
53
54
# File 'app/controllers/goldencobra/application_controller.rb', line 50

def method_missing(meth, *args)
  unless [:before_init, :before_render, :after_init, :after_index].include?(meth.to_sym)
    super
  end
end

Instance Method Details

#access_denied(exception) ⇒ Object



23
24
25
# File 'app/controllers/goldencobra/application_controller.rb', line 23

def access_denied(exception)
  redirect_to root_path, alert: exception.message
end

#after_sign_in_path_for(resource_or_scope) ⇒ Object



19
20
21
# File 'app/controllers/goldencobra/application_controller.rb', line 19

def (resource_or_scope)
  request.referrer
end

#after_sign_out_path_for(resource_or_scope) ⇒ Object



15
16
17
# File 'app/controllers/goldencobra/application_controller.rb', line 15

def after_sign_out_path_for(resource_or_scope)
  request.referrer
end

#initialize_article(current_article) ⇒ Object



40
41
42
43
44
45
# File 'app/controllers/goldencobra/application_controller.rb', line 40

def initialize_article(current_article)
  Goldencobra::Article.load_liquid_methods(location: session[:user_location],
                                           article: @article,
                                           params: params)
  set_meta_tags current_article.combined_meta_tags
end

#s(name) ⇒ Object



35
36
37
38
# File 'app/controllers/goldencobra/application_controller.rb', line 35

def s(name)
  return unless name.present?
  Goldencobra::Setting.for_key(name)
end

#set_localeObject



7
8
9
10
11
12
13
# File 'app/controllers/goldencobra/application_controller.rb', line 7

def set_locale
  if Rails.env == "test"
    I18n.locale = :de
  else
    I18n.locale = params[:locale] || session[:locale]
  end
end