5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/partial_path_customizer/partial_path_helper.rb', line 5
def customize_partial_path object, partial_name_or_callable
partial_path_callable = proc{|model| "#{model.class.model_name.plural}/#{partial_name_or_callable}" }
if partial_name_or_callable.respond_to?(:call)
partial_path_callable = partial_name_or_callable
end
if object.respond_to?(:map)
PartialPathCustomizer::Presenter.wrap_collection(object, &partial_path_callable)
else
PartialPathCustomizer::Presenter.new(object, &partial_path_callable)
end
end
|