Sha256: 67368b31a78190dcc82b44bad3cf3ced22368cb11e047558bfe5ea57172b0e7c

Contents?: true

Size: 818 Bytes

Versions: 5

Compression:

Stored size: 818 Bytes

Contents

module AridCache
  # A class with framework/application related methods like discovering
  # which version of Rails we are running under.
  class Framework
    def active_record?(major=nil)
      defined?(::ActiveRecord) && (major.nil? || (major && ::ActiveRecord::VERSION::MAJOR == major))
    end

    # Include framework hooks for Rails
    #
    # This method is called by <tt>init.rb</tt>, which is run by Rails on startup.
    #
    # Customize rendering.  Include custom headers and don't render the layout for AJAX.
    # Insert the Rack::Ajax middleware to rewrite and handle requests.
    # Add custom attributes to outgoing links.
    #
    # Hooks for Rails 3 are installed using Railties.
    def init
      ::ActiveRecord::Base.send(:include, AridCache::ActiveRecord) if active_record?
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
arid_cache-1.4.4 lib/arid_cache/framework.rb
arid_cache-1.4.3 lib/arid_cache/framework.rb
arid_cache-1.4.2 lib/arid_cache/framework.rb
arid_cache-1.4.1 lib/arid_cache/framework.rb
arid_cache-1.4.0 lib/arid_cache/framework.rb