Search code examples
ruby-on-railsruby-on-rails-4locale

routing-filter does not work on rails 4


I am trying to convert ?locale=en in routes to /en/ I found routing-filter gem but if I try to run rails, I get this error:

samir@samir-VirtualBox:~/RubymineProjects/dcaclab$ rails s
/home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `require': cannot load such file -- routing_filter/adapters/rails_4 (LoadError)
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `block in require'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:214:in `load_dependency'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `require'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/routing-filter-0.3.1/lib/routing_filter.rb:27:in `<top (required)>'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `require'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `block in require'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:214:in `load_dependency'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `require'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/routing-filter-0.3.1/lib/routing-filter.rb:1:in `<top (required)>'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `require'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `each'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `block in require'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `each'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `require'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/bundler-1.5.3/lib/bundler.rb:131:in `require'
    from /home/samir/RubymineProjects/dcaclab/config/application.rb:8:in `<top (required)>'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/railties-4.0.3/lib/rails/commands.rb:74:in `require'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/railties-4.0.3/lib/rails/commands.rb:74:in `block in <top (required)>'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/railties-4.0.3/lib/rails/commands.rb:71:in `tap'
    from /home/samir/.rvm/gems/ruby-2.1.0@dcaclab/gems/railties-4.0.3/lib/rails/commands.rb:71:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Any idea how to solve this?


Solution

  • The version of the gem you are currently using is probably not compatible with Rails 4. You need to have version 0.4.0.pre, which can be installed through gem install routing-filter --pre or by editing your gemfile. I have found this issue, which relates to your problem: https://github.com/svenfuchs/routing-filter/issues/48