没有任何数据可供显示
开源项目社区 | 当前位置 : |
|
www.trustie.net/open_source_projects | 主页 > 开源项目社区 > acts-as-tiny-url |
acts-as-tiny-url
|
0 | 0 | 7 |
贡献者 | 讨论 | 代码提交 |
概述
This is a Ruby on Rails plugin that will allow you to pass in a URL, and it will return a shortened URL by calling TinyURL.Installationscript/plugin install http://acts-as-tiny-url.googlecode.com/svn/trunk/acts_as_tiny_urlUsageActsAsTinyURL utilizes TinyURL's API to allow you to pass in any URL and have it generate a shortened URL on the fly.
If you want one of your model's to be able to use ActsAsTinyURL, just add the following line right under the class declaration of one of your controllers.
include ActsAsTinyURLOptionsThe validate_uri option allows you to check, before trying to retrieve a URL, whether or not it is formatted correctly.
Example Usagedef ApplicationController < ActionController::Baseinclude ActsAsTinyURL
endtiny_url("http://brendanlim.com")
- returns http://tinyurl.com/3274fk
- returns true
- returns falseCopyright (c) 2008 Brendan G. Lim (brendangl@gmail.com), released under the MIT license
创建时间:2014-05-07 20:24