Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/auser/temporarily-linkable
Temporary link plugin. Easily create temporary links that expire after use or a time frame
https://github.com/auser/temporarily-linkable
Last synced: about 2 months ago
JSON representation
Temporary link plugin. Easily create temporary links that expire after use or a time frame
- Host: GitHub
- URL: https://github.com/auser/temporarily-linkable
- Owner: auser
- License: mit
- Created: 2008-07-09T17:00:46.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2008-07-09T17:01:40.000Z (over 16 years ago)
- Last Synced: 2024-10-12T10:17:25.634Z (3 months ago)
- Language: Ruby
- Homepage:
- Size: 82 KB
- Stars: 5
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: MIT-LICENSE
Awesome Lists containing this project
README
TemporarilyLinkable
===================Easy.
Just call temporarily_linkable in a model you want to add temporary links to.
Then, when you want to create a temporary link, just call
create_temporary_link
and you've got a temporarily_linkable for the object.Then, in your model, you have access to the method:
find_by_temporary_token to retrieve your object.
Example
=======class User < ActiveRecord::Base
temporarily_linkable
end@user.create_temporary_link
# account_controller
def retrieve
@user = User.find_by_temporary_token(params[:token])
endYou can also find the user by active temporary tokens with
User.find_by_active_temporary_token(params[:token])The temporary links expire after one week by default, but the plugin does not require you to handle the expiration date.
Done and done.
Copyright (c) 2007 [CitrusByte::Ari Lerner], released under the MIT license