0.0
No commit activity in last 3 years
No release in over 3 years
Example of creating a Ruby gem for ASCIIcast #301
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

UrrlFormatter Build Status

Format and validate a URL attribute in Active Record. This is an example gem created for RailsCasts episode #301.

Installation

Add this line to your application's Gemfile:

gem 'urrl_formatter'

And then execute:

$ bundle

Or install it yourself as:

$ gem install urrl_formatter

Usage

Call format_url in an ActiveRecord class and pass the name of the attribute you wish to format into a URL and validate.

class Comment < ActiveRecord::Base
  format_url :website
end

This will automatically add "http://" to the beginning of the website attribute upon saving if no protocol is present. It will also do validation to ensure it looks like a URL.

Development

Questions or problems? Please post them on the issue tracker. You can contribute changes by forking the project and submitting a pull request. You can ensure the tests passing by running bundle and rake.

This gem is created by Ryan Bates and is under the MIT License.