{"id":19001428,"url":"https://github.com/bumi/find_by_param","last_synced_at":"2025-04-22T17:46:36.402Z","repository":{"id":387771,"uuid":"5257","full_name":"bumi/find_by_param","owner":"bumi","description":"(deprecated) Find_by_param is a nice and easy way to handle permalinks and dealing with searching for to_param values","archived":false,"fork":false,"pushed_at":"2011-09-19T15:14:36.000Z","size":147,"stargazers_count":30,"open_issues_count":0,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T17:23:13.014Z","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/bumi.png","metadata":{"files":{"readme":"README.rdoc","changelog":"History.txt","contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2008-03-25T12:26:27.000Z","updated_at":"2019-08-13T13:22:18.000Z","dependencies_parsed_at":"2022-08-16T10:20:13.453Z","dependency_job_id":null,"html_url":"https://github.com/bumi/find_by_param","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/bumi%2Ffind_by_param","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bumi%2Ffind_by_param/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bumi%2Ffind_by_param/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bumi%2Ffind_by_param/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bumi","download_url":"https://codeload.github.com/bumi/find_by_param/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249173084,"owners_count":21224483,"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-11-08T18:11:09.387Z","updated_at":"2025-04-16T22:31:17.304Z","avatar_url":"https://github.com/bumi.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"= find_by_param\n\n_find_by_param_ helps you dealing with permalinks and finding objects by our\npermalink value\n\n    class Post \u003c ActiveRecord:Base\n      make_permalink :with =\u003e :title\n    end\n\nnow you can do\n  \n    Post.find_by_param(...)\n\nIf you have a permalink-column _find_by_param_ saves the permalink there and\nuses that otherwise it just uses the provided attribute.\n\n\n== Installation\n\n=== Via RubyGems\n\n    % gem install find_by_param\n\n=== Building your own\n\n    % gem build find_by_param.gemspec\n    % gem install find_by_param-VERSION.gem\n\n=== As Rails plugin\n\n    % script/plugin install git://github.com/bumi/find_by_param.git\n\nfind_by_param is known to work with Rails 2.3, 3.0 and 3.1.\n\n\n== Examples\n\n=== Configuration\n\n    make_permalink :with =\u003e :login\n    make_permalink :with =\u003e :title, :prepend_id =\u003e true\n    make_permalink :with =\u003e :name, :forbidden =\u003e %w(new edit)\n\n=== Client code\n\n    Post.create(:title =\u003e \"hey ho let's go!\").to_param #=\u003e \"hey-ho-lets-go\"\n              # ... to_param is the method Rails calls to create the URL values\n\n    Post.find_by_param(\"hey-ho-lets-go\") #=\u003e \u003cPost\u003e\n\n    Post.find_by_param(\"is-not-there\")   #=\u003e nil\n    Post.find_by_param!(\"is-not-there\")  #=\u003e raises ActiveRecord::RecordNotFound\n\n\n== Basic Documentation\n\n=== Options for make_permalink\n\nThe following options may be used, when configuring the permalink generation\nwith +make_permalink+.\n\n* \u003ctt\u003e:with\u003c/tt\u003e (required)\n\n  The attribute that should be used as permalink\n\n* \u003ctt\u003e:field\u003c/tt\u003e\n\n  The name of your permalink column. make_permalink first checks if there is\n  a column.\n\n* \u003ctt\u003e:prepend_id =\u003e [true|false]\u003c/tt\u003e\n\n  Do you want to prepend the ID to the permalink? for URLs like:\n  \u003ctt\u003eposts/123-my-post-title\u003c/tt\u003e - _find_by_param_ uses the ID column to\n  search.\n\n* \u003ctt\u003e:param_size =\u003e [Number]\u003c/tt\u003e\n  \n  Desired maximum size of the permalink, default is 50.\n\n* \u003ctt\u003e:escape =\u003e [true|false]\u003c/tt\u003e\n\n  Do you want to escape the permalink value? (strip chars like\n  \u003ctt\u003eöä?\u0026\u003c/tt\u003e) - actually you must do that\n\n* \u003ctt\u003e:forbidden =\u003e [Regexp|String|Array of Strings]\u003c/tt\u003e\n\n  Define which values should be forbidden. This is useful when combining user\n  defined values to generate permalinks in combination with restful routing.\n  \u003cb\u003eMake sure, especially in the case of a Regexp argument, that values may\n  become valid by adding or incrementing a trailing integer.\u003c/b\u003e\n\n\n=== Class methods provided by _find_by_param_\n\nThe following methods are added as public methods to all classes containing a\npermalink field.\n\n* \u003ctt\u003efind_by_param(id)\u003c/tt\u003e\n\n  Look up a value by its permalink value, returns matching instance or\n  +nil+, if none is found.\n\n* \u003ctt\u003efind_by_param!(id)\u003c/tt\u003e\n\n  Look up a value by its permalink value, returns matching instance or\n  raises \u003ctt\u003eActiveRecord::RecordNotFound\u003c/tt\u003e, if none is found.\n\n\n=== Issues\n\n* Alex Sharp (http://github.com/ajsharp) pointed to an issue with STI. Better call make_permalink in every child class and not only in the parent class..\n* write nice docs\n* write nicer tests\n\nCopyright (c) 2007 [Michael Bumann - Railslove.com], released under the MIT license\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbumi%2Ffind_by_param","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbumi%2Ffind_by_param","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbumi%2Ffind_by_param/lists"}