Array support #298

Closed
wants to merge 3 commits into
from
View
@@ -9,6 +9,7 @@
require 'draper/helper_support'
require 'draper/view_context'
require 'draper/decorated_enumerable_proxy'
+require 'draper/array_support'
require 'draper/railtie' if defined?(Rails)
# Test Support
@@ -0,0 +1,7 @@
+module Draper::ArraySupport
+
+ def decorate
+ collect { |item| item.respond_to?(:decorator_class) ? item.decorate : item }
+ end
+
+end
@@ -39,6 +39,10 @@ class Railtie < Rails::Railtie
self.send(:include, Draper::ModelSupport)
end
end
+
+ initializer "draper.extend_array" do |app|
+ Array.send(:include, Draper::ArraySupport)
+ end
console do
require 'action_controller/test_case'