Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 16 lines (12 sloc) 0.853 kb
39aa1be @willbryant wrote a handy plugin for displaying records in easy-to-read table for…
authored
1 require 'table_display'
2
3 # all Enumerable classes should get TableDisplay functionality...
4 Enumerable.send(:include, TableDisplay)
5
6 # including those that have already included Enumerable by the time this plugin is loaded.
7 # Ruby doesn't recursively update through the module tree, so although any new classes/modules
8 # that include Enumerable will get TableDisplay, we have to do it ourself for older ones.
9 ObjectSpace.each_object(Module) {|o| o.send(:include, TableDisplay) if o.ancestors.include?(Enumerable)}
10 ObjectSpace.each_object(Class) {|o| o.send(:include, TableDisplay) if o.ancestors.include?(Enumerable)}
11
e9e1bf6 @willbryant Rails 3 compatibility
authored
12 # Rails 2.3 named_scopes certainly quack like enumerables, but surprisingly they don't themself include Enumerable.
13 if ActiveRecord::NamedScope.const_defined?(:Scope)
14 ActiveRecord::NamedScope::Scope.send(:include, TableDisplay)
15 end
Something went wrong with that request. Please try again.