Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add array support

  • Loading branch information...
commit 4d5b4809f5f80bdc21f731f9431097e287288688 1 parent 9a80098
@barelyknown barelyknown authored
View
1  lib/draper.rb
@@ -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
View
7 lib/draper/array_support.rb
@@ -0,0 +1,7 @@
+module Draper::ArraySupport
+
+ def decorate
+ collect { |item| item.decorate if item.respond_to? :decorator_class }
+ end
+
+end
View
4 lib/draper/railtie.rb
@@ -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'
Please sign in to comment.
Something went wrong with that request. Please try again.