Class: AridCache::Framework
- Inherits:
-
Object
- Object
- AridCache::Framework
- Defined in:
- lib/arid_cache/framework.rb
Overview
A class with framework/application related methods like discovering which version of Rails we are running under.
Instance Method Summary collapse
- #active_record?(major = nil) ⇒ Boolean
-
#init ⇒ Object
Include framework hooks for Rails.
Instance Method Details
#active_record?(major = nil) ⇒ Boolean
5 6 7 |
# File 'lib/arid_cache/framework.rb', line 5 def active_record?(major=nil) defined?(::ActiveRecord) && (major.nil? || (major && ::ActiveRecord::VERSION::MAJOR == major)) end |
#init ⇒ Object
Include framework hooks for Rails
This method is called by init.rb, 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.
18 19 20 |
# File 'lib/arid_cache/framework.rb', line 18 def init ::ActiveRecord::Base.send(:include, AridCache::ActiveRecord) if active_record? end |