Sha256: ab3476314cd3680228faf86a83baa6f03dd9ac291772542bec1e3ea5a6ede38f

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

= sinatra-url-for

<code>sinatra-url-for</code> constructs absolute paths and full URLs for
handlers in a Sinatra application.  Assuming that your application is
running on <code>example.com</code>, and that it has been mapped to
<code>/myapp</code>, you should be able call +url_for+ from within a
handler as follows:

  url_for "/"            # Returns "/myapp/"
  url_for "/foo"         # Returns "/myapp/foo"
  url_for "/foo", :full  # Returns "http://example.com/myapp/foo"

To install it, run:

  sudo gem install emk-sinatra-url-for -s http://gems.github.com

To include it in a Sinatra application, write:

  require 'rubygems'
  gem 'emk-sinatra-url-for'
  require 'sinatra/url_for'

If you're subclassing <code>Sinatra::Base</code>, then you need to call
<code>helpers</code> manually:

  class MyApp < Sinatra::Base
    helpers Sinatra::UrlForHelper
    # ...
  end

Thanks to "cypher23" on #mephisto and the folks on #rack for pointing me in
the right direction.  If this gem fails to work correctly on your
system, please feel free to submit patches and/or bug reports!

== Copyright

Copyright 2009 Eric Kidd. See LICENSE for details.

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
sinatra-url-for-0.2.2.1 README.rdoc
tobias-sinatra-url-for-0.2.1 README.rdoc