Module: Hobo::Controller

Includes:
AuthenticationSupport, Cache
Included in:
Model
Defined in:
lib/hobo/controller.rb,
lib/hobo/controller/cache.rb,
lib/hobo/controller/model.rb,
lib/hobo/controller/user_base.rb,
lib/hobo/controller/authentication_support.rb

Defined Under Namespace

Modules: AuthenticationSupport, Cache, ClassMethods, Model, UserBase

Class Method Summary collapse

Methods included from Cache

#expire_swept_caches_for

Methods included from AuthenticationSupport

#authenticated_user_from_cookie, #authorized?, #create_auth_cookie, #logged_in?, #login_from_cookie, #login_required, #redirect_back_or_default, #store_location

Class Method Details

.included(base) ⇒ Object



10
11
12
13
14
# File 'lib/hobo/controller.rb', line 10

def included(base)
  if base.is_a?(Class)
    included_in_class(base)
  end
end

.included_in_class(klass) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/hobo/controller.rb', line 16

def included_in_class(klass)
  klass.extend(ClassMethods)
  klass.class_eval do
    before_filter :login_from_cookie
    alias_method_chain :redirect_to, :object_url
    private
    def set_mailer_default_url_options
      unless Rails.application.config.action_mailer.default_url_options
        Rails.application.config.action_mailer.default_url_options = { :host => request.host }
        Rails.application.config.action_mailer.default_url_options[:port] = request.port unless request.port == 80
      end
    end
    before_filter :set_mailer_default_url_options
    @included_taglibs = []
    rescue_from ActionController::RoutingError, :with => :not_found unless Rails.env.development?
  end
  HoboRouteHelper.add_to_controller(klass)
  HoboTranslationsHelper.add_to_controller(klass)
  HoboTranslationsNormalizerHelper.add_to_controller(klass)
  HoboPermissionsHelper.add_to_controller(klass)
end