{"id":18045433,"url":"https://github.com/lance/acts_as_keyable","last_synced_at":"2025-04-05T03:41:59.368Z","repository":{"id":510822,"uuid":"138513","full_name":"lance/acts_as_keyable","owner":"lance","description":"Uses Rails routing to make nice URLs so you get /books/oliver_twist instead of /books/1234","archived":false,"fork":false,"pushed_at":"2009-02-26T21:02:09.000Z","size":80,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-10T11:48:48.565Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lance.png","metadata":{"files":{"readme":"README.textile","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-02-26T20:15:21.000Z","updated_at":"2019-08-13T14:04:23.000Z","dependencies_parsed_at":"2022-08-16T10:25:28.409Z","dependency_job_id":null,"html_url":"https://github.com/lance/acts_as_keyable","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/lance%2Facts_as_keyable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lance%2Facts_as_keyable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lance%2Facts_as_keyable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lance%2Facts_as_keyable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lance","download_url":"https://codeload.github.com/lance/acts_as_keyable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247284914,"owners_count":20913691,"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":[],"created_at":"2024-10-30T18:13:13.038Z","updated_at":"2025-04-05T03:41:59.342Z","avatar_url":"https://github.com/lance.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"h1. Acts As Keyable\n\nThis is a simple acts_as extension for Rails apps.  It makes use of some nice Rails 2.x features and RESTful routes\nin order to provide you with even prettier URLs.  By default Rails scaffolds generate URLS such as\n@http://yoursite.com/members/4@ or for nested routed @http://yoursite.com/members/4/plans@ which isn't really\nideal if you want pretty URLs.  Acts as Keyable gives you something this: @http://yoursite.com/members/john/plans@.\n\nh2. Installation\n\nCopy @acts_as_keyable.rb@ into your @RAILS_ROOT/lib@ and add this to the models you want to have pretty URLs, e.g.\n\n\u003cpre\u003e\u003ccode\u003e\n  require 'acts_as_keyable'\n  class Member \u003c ActiveRecord::Base\n    acts_as_keyable :username\n  end\n\u003c/pre\u003e\u003c/code\u003e\n\nAny ActiveRecord class you make keyable must have a @key@ column of type @:string@.  You specify what field to\nuse to generate the key with a parameter.  Another example:\n\n\u003cpre\u003e\u003ccode\u003e\n  require 'acts_as_keyable'\n  class Book \u003c ActiveRecord::Base\n    acts_as_keyable :title\n  end\n\u003c/pre\u003e\u003c/code\u003e\n\nActs as Keyable will call @validates_presence_of@ and @validates_uniqueness_of@ for the parameter provided.\nThe key is set when the object is created and not modified thereafter.  It may be modified manually, e.g.\n\n\u003cpre\u003e\u003ccode\u003e\n  Book.find(:first).key = Book.generate_key_for(:some_other_thing)\n\u003c/pre\u003e\u003c/code\u003e\n\nKeys are shortened to just alphanumeric characters.  So a username of \"john_doe\" becomes a key of \"johndoe\".\nIf there is already a key \"johndoe\" in the database, then a monotonically increasing number will be appended\nto the key, e.g. \"johndoe_1\" and \"johndoe_2\".","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flance%2Facts_as_keyable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flance%2Facts_as_keyable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flance%2Facts_as_keyable/lists"}