diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-05-08 14:57:41 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-05-08 14:57:41 +0900 |
commit | 0af2ab18fa7914380150c0403289a9d99ea45ded (patch) | |
tree | ab8657499ac7d7984ff0d193de61ffdd21a6923c /app/models/concerns/iid_routes.rb | |
parent | 632b87a80e4e349ffc5fde585e661f51d6bec7e4 (diff) | |
download | gitlab-ce-0af2ab18fa7914380150c0403289a9d99ea45ded.tar.gz |
Decouple to_params from AtomicInternalId concern
Diffstat (limited to 'app/models/concerns/iid_routes.rb')
-rw-r--r-- | app/models/concerns/iid_routes.rb | 9 |
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..50957e0230d --- /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 |