debian-mirror-gitlab/app/models/concerns/iid_routes.rb

12 lines
408 B
Ruby
Raw Normal View History

2018-11-20 20:47:30 +05:30
# frozen_string_literal: true
2018-11-08 19:23:39 +05:30
module IidRoutes
##
# This automagically enforces all related routes to use `iid` instead of `id`
# If you want to use `iid` for some routes and `id` for other routes, this module should not to be included,
2019-07-07 11:18:12 +05:30
# instead you should define `iid` or `id` explicitly at each route generators. e.g. pipeline_path(project.id, pipeline.iid)
2018-11-08 19:23:39 +05:30
def to_param
iid.to_s
end
end