title: Proper config for rack-rewrite with unicorn for local dev and heroku
body: <p>I'm trying to figure out how to properly setup <a href="https://github.com/jtrupiano/rack-rewrite" rel="nofollow">rack-rewrite</a> and am having some trouble. I'm a bit of a noob and the site isn't super clear on the setup. I have a couple of questions if anyone knows more about it. </p>
  
  <p>1) Do I need to put the gem in both my <code>gemfile</code> and the <code>config.ru</code> file? (per the "Sample rackup file" in the section of the README)</p>
  
  <p>2) Do I need to have rack-rewrite setup in both my <code>config.ru</code> file and my <code>config/application.rb</code> file? (per the "Sample rackup file" and "Sample usage in a rails app" sections of the README) </p>
  
  <p>3) Where in my <code>application.rb</code> file do I put the config? In the <code>class Application &lt; Rails::Application</code> block?</p>
  
  <p>4) I have tried both of the above, however, when I start <code>unicorn</code> locally, I get the following error</p>
  
  <pre><code>    $ unicorn
  I, [2014-05-13T16:57:00.926144 #17432]  INFO -- : Refreshing Gem list
  /config/environment.rb:2:in `require': /config/application.rb:98: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)
    from /config/environment.rb:2:in `&lt;top (required)&gt;'
    from config.ru:4:in `require'
    from config.ru:4:in `block in &lt;main&gt;'
    from /Users/me/.rvm/gems/ruby-2.0.0-p0@mysite/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
    from /Users/me/.rvm/gems/ruby-2.0.0-p0@mysite/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
    from config.ru:1:in `new'
    from config.ru:1:in `&lt;main&gt;'
    from /Users/me/.rvm/gems/ruby-2.0.0-p0@mysite/gems/unicorn-4.8.2/lib/unicorn.rb:48:in `eval'
    from /Users/me/.rvm/gems/ruby-2.0.0-p0@mysite/gems/unicorn-4.8.2/lib/unicorn.rb:48:in `block in builder'
    from /Users/me/.rvm/gems/ruby-2.0.0-p0@mysite/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:760:in `call'
    from /Users/me/.rvm/gems/ruby-2.0.0-p0@mysite/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:760:in `build_app!'
    from /Users/me/.rvm/gems/ruby-2.0.0-p0@mysite/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:137:in `start'
    from /Users/me/.rvm/gems/ruby-2.0.0-p0@mysite/gems/unicorn-4.8.2/bin/unicorn:126:in `&lt;top (required)&gt;'
    from /Users/me/.rvm/gems/ruby-2.0.0-p0@mysite/bin/unicorn:23:in `load'
    from /Users/me/.rvm/gems/ruby-2.0.0-p0@mysite/bin/unicorn:23:in `&lt;main&gt;'
    from /Users/me/.rvm/gems/ruby-2.0.0-p0@mysite/bin/ruby_noexec_wrapper:14:in `eval'
    from /Users/me/.rvm/gems/ruby-2.0.0-p0@mysite/bin/ruby_noexec_wrapper:14:in `&lt;main&gt;'&gt;'
  </code></pre>
  
  <p><strong>--------------------UPDATE--------------------</strong></p>
  
  <p>I've worked out the issues above. It seems that the gem is pretty versatile in so much as you can set it up in <code>application.rb</code>, <code>config.ru</code>, or create a <code>rack_rewrite.rb</code> file in the initializers directory. </p>
  
  <p>Does anyone have any opinion of where the best place to put the code is? </p>
  
  <p>Also, is there a way to account for a trailing <code>/</code> in redirects? For instance, is there a way to condense this into a single line?</p>
  
  <pre><code>r301 '/for-gyms-and-rec-centers', '/venues/3'
  r301 '/for-gyms-and-rec-centers/', '/venues/3/
  </code></pre>