smidig/conference-app — pull request #45 by badeball (2013-06-06 18:52:50+00:00)
Title: DRYing up method for prefixing URIs with schema.

As I noticed that there were more fields containing URIs, I realized that there were need for a more DRY method of assigning a 'prefix-with-default-scheme' property to fields. A module contained in ./lib now does this. It is automatically required in the application and used the following way.

```ruby
class Sponsor < ActiveRecord::Base
add_default_scheme :url, :imageUrl, :default_scheme => 'https'
end
```

This will dynamically generate wrapper methods around the setters for the fields specified and prepend a scheme to the value.

```ruby
sponsor = Sponsor.new
sponsor.url = 'url-without-scheme'
puts sponsor.url # => 'https://url-without-scheme'
```