Class: ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
ApplicationHelper, LoginSystem
Defined in:
app/controllers/application.rb

Overview

Filters added to this controller will be run for all controllers in the application. Likewise, all the methods added will be available for all controllers.

Instance Method Summary collapse

Methods included from ApplicationHelper

#current_locale, #current_user, #dynjs_include_tag, #pagetext, #render_diff_table, #server_url_for

Instance Method Details

#check_desired_login_availableObject



50
51
52
53
54
55
56
# File 'app/controllers/application.rb', line 50

def 
  if current_user.nil?
     = params[:desired_login] || flash[:desired_login]
    @login_not_available = ! User.().nil?
  end
  true
end

#drop_top_crumbsObject



58
59
60
# File 'app/controllers/application.rb', line 58

def drop_top_crumbs
  @crumbs = [{ 'Home'.t => {:controller => 'root', :action => 'index'} }]
end

#set_localeObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/controllers/application.rb', line 30

def set_locale
  default_locale = 'en-US'
  request_language = request.env['HTTP_ACCEPT_LANGUAGE']
  request_language = request_language.nil? ? nil : request_language[/[^,;]+/]
  
  @locale = params[:locale] || session[:locale] ||
            request_language || default_locale
  session[:locale] = @locale
  begin
    Locale.set @locale
  rescue
    @locale = default_locale
    Locale.set @locale
  end
end

#setup_rendererObject



46
47
48
# File 'app/controllers/application.rb', line 46

def setup_renderer
  @renderer = create_renderer
end