I'm trying to figure out how to properly setup rack-rewrite 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.
1) Do I need to put the gem in both my gemfile and the config.ru file? (per the "Sample rackup file" in the section of the README)
2) Do I need to have rack-rewrite setup in both my config.ru file and my config/application.rb file? (per the "Sample rackup file" and "Sample usage in a rails app" sections of the README)
3) Where in my application.rb file do I put the config? In the class Application < Rails::Application block?
4) I have tried both of the above, however, when I start unicorn locally, I get the following error
$ 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 `<top (required)>'
from config.ru:4:in `require'
from config.ru:4:in `block in <main>'
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 `<main>'
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 `<top (required)>'
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 `<main>'
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 `<main>'>'
--------------------UPDATE--------------------
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 application.rb, config.ru, or create a rack_rewrite.rb file in the initializers directory.
Does anyone have any opinion of where the best place to put the code is?
Also, is there a way to account for a trailing / in redirects? For instance, is there a way to condense this into a single line?
r301 '/for-gyms-and-rec-centers', '/venues/3'
r301 '/for-gyms-and-rec-centers/', '/venues/3/