Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Campbell authored and Paul Campbell committed Dec 3, 2009
1 parent 6f4ed96 commit 4b5e5a7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions README.textile
Expand Up @@ -26,6 +26,16 @@ Https? That works too (but one way only)

h2. Extra

h3. Multiple fields

If you have multiple url_fields in a single model, just pass them as arguments to the url_field method, eg:

<pre><code>class Company < ActiveRecord::Base
url_field :website, :support_website, :more_info_website
end</code></pre>

h3. Access the correctly formed URL at any time

If you want access to the correctly formatted URL at any time (for example if you're passing it to URI.parse, before you save your model), you can prefix your URL field method name with "cleaned_" eg. "cleaned_website" if your field name was website:

<pre><code>class Company < ActiveRecord::Base
Expand All @@ -34,8 +44,7 @@ end

@company = Company.new
@company.website = "www.example.com"
@company.cleaned_website # => "http://www.example.com"
</code></pre>
@company.cleaned_website # => "http://www.example.com"</code></pre>

h2. Install

Expand Down

0 comments on commit 4b5e5a7

Please sign in to comment.