summaryrefslogtreecommitdiff
path: root/app/models/concerns/iid_routes.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/concerns/iid_routes.rb')
-rw-r--r--app/models/concerns/iid_routes.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/concerns/iid_routes.rb b/app/models/concerns/iid_routes.rb
new file mode 100644
index 00000000000..246748cf52c
--- /dev/null
+++ b/app/models/concerns/iid_routes.rb
@@ -0,0 +1,9 @@
+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,
+ # instead you should define `iid` or `id` explictly at each route generators. e.g. pipeline_path(project.id, pipeline.iid)
+ def to_param
+ iid.to_s
+ end
+end