{"id":22214272,"url":"https://github.com/inouridder/draw_static","last_synced_at":"2025-07-27T12:32:01.989Z","repository":{"id":62557496,"uuid":"182076711","full_name":"InouRidder/draw_static","owner":"InouRidder","description":"Generating routes for static controller","archived":false,"fork":false,"pushed_at":"2020-04-29T12:36:06.000Z","size":43,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-18T04:04:10.615Z","etag":null,"topics":["for","generator","rails","routes","static"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/InouRidder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-18T11:39:23.000Z","updated_at":"2023-03-20T19:40:05.000Z","dependencies_parsed_at":"2022-11-03T06:30:27.027Z","dependency_job_id":null,"html_url":"https://github.com/InouRidder/draw_static","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InouRidder%2Fdraw_static","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InouRidder%2Fdraw_static/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InouRidder%2Fdraw_static/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InouRidder%2Fdraw_static/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InouRidder","download_url":"https://codeload.github.com/InouRidder/draw_static/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227802814,"owners_count":17822113,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["for","generator","rails","routes","static"],"created_at":"2024-12-02T21:15:15.139Z","updated_at":"2024-12-02T21:15:15.983Z","avatar_url":"https://github.com/InouRidder.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# draw_static\n\n## Cleaning up your static routes in rails\n\n```\nget 'home', to: 'pages#home'\nget 'about', to: 'pages#about'\nget 'contact-us', to: 'pages#contact_us'\n```\n\n### Familiar?\n\nAdd\n\n```\n# Gemfile\ngem 'draw_static'\n```\nTo the Gemfile and then run bundle install, then add\n\n```\n# routes.rb\n\nRails.application.routes.draw do\n  draw_static :pages # Or which controller you are using for static routes\nend\n```\n\nThis set up will generate the static routes based on the controller actions.\nIn this case we are generating the routes for the PagesController, if you want to do it for your PublicPagesController then you would pass: :public_pages\n\nThe controller action has to be the same name as the path. All non-word characters in the controller actions name are replaced by hyphens in the path.\n\ne.g\n```\ndef about_us\nend\n```\nWill become\n```\nget 'about-us', to: 'pages#about_us'\n```\n\n\n### Multiple controllers\nYou can specify as many controllers as you like.\n\n```\n# routes.rb\n\nRails.application.routes.draw do\n  draw_static :pages, :public, :sales # Or which controller you are using for static routes\nend\n\n```\n\n### Limits\n```\n# You can limit the routes that are generated by using except or only\n\ndraw_static :pages, only: [:home, :contact]\ndraw_static :pages, except: [:contact]\n\n# also works for multiple controllers\n\ndraw_static :pages, :public, except: [:home, :contact]\n\n# actions called either contact or home will be filtered from all controllers.\n\n```\n\n### Enjoy!\n\n\n### Rails\n\ndraw_static is a gem for the rails framework, read more about the rails frame work here\nhttps://github.com/rails/rails\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finouridder%2Fdraw_static","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finouridder%2Fdraw_static","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finouridder%2Fdraw_static/lists"}