Module: PolymorphicRender::ApplicationHelper
- Defined in:
- app/helpers/polymorphic_render/application_helper.rb
Instance Method Summary collapse
Instance Method Details
#polymorphic_render(resource, suffix = nil, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'app/helpers/polymorphic_render/application_helper.rb', line 3 def polymorphic_render(resource, suffix = nil, = {}) if resource.is_a? ActiveRecord::Base path = [resource.to_partial_path, *Array(suffix)].select(&:present?).join('_') name = File.basename(resource.to_partial_path) render .merge(partial: path, object: resource, as: name) else capture do resource.each{ |res| concat polymorphic_render(res, suffix, ) } end end end |