Skip to content

Let namespace_project path/URL helpers take `*project` instead of `project.namespace, project`

Douwe Maan requested to merge dm-project-path-helpers into master

@smcgivern What do you think, is this worth implementing Project#to_a over?

I also tried adding this to GitlabRoutingHelper or Gitlab::Routing, but that didn't work because at that point Gitlab::Application.routes doesn't contain all the routes yet:

Gitlab::Application.routes.named_routes.helper_names.each do |name|
  next unless name.include?('namespace_project')

  define_method(name.sub('namespace_project', 'project')) do |project, *args|
    send(name, project&.namespace, project, *args)
  end
end

Merge request reports