Sha256: 6e22e3f331ff79e2cda7c9098decca7aa6268584c6473414c9c4b3bb3fd2a03a

Contents?: true

Size: 941 Bytes

Versions: 2

Compression:

Stored size: 941 Bytes

Contents

module DT
  module ActionControllerExtensions   #:nodoc:
    def self.included(owner)    #:nodoc:
      owner.extend MetaClassMethods
    end

    module MetaClassMethods
      # Inform framework that our controller handles DT.
      #   class ApplicationController < ActionController::Base
      #     handles_dt
      #   end
      def handles_dt
        # NOTE: after_filter() is nicer and lets debug more, but... It's not getting control when there's a rendering exception, such as 404.
        #       Use console and log to debug complex stuff like prefilters.
        before_filter {DT.clear}
      end
    end # MetaClassMethods
  end # ActionControllerExtensions
end # DT

# NOTE: This MUST be outside DT module, otherwise rdoc will produce ugly doc for DT module.
if defined? ::ActionController::Base
  module ::ActionController    #:nodoc:
    class Base    #:nodoc:
      include DT::ActionControllerExtensions
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_dt-0.1.1 lib/dt/action_controller_extensions.rb
rails_dt-0.1.0 lib/dt/action_controller_extensions.rb