method

merge_prefix_into_object_path

Importance_0
v7.0.0 - Show latest stable - 0 notes - Class: ObjectRendering
merge_prefix_into_object_path(prefix, object_path) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionview/lib/action_view/renderer/abstract_renderer.rb, line 92
        def merge_prefix_into_object_path(prefix, object_path)
          if prefix.include?(//) && object_path.include?(//)
            prefixes = []
            prefix_array = File.dirname(prefix).split("/")
            object_path_array = object_path.split("/")[0..-3] # skip model dir & partial

            prefix_array.each_with_index do |dir, index|
              break if dir == object_path_array[index]
              prefixes << dir
            end

            (prefixes << object_path).join("/")
          else
            object_path
          end
        end
Register or log in to add new notes.