svenfuchs/routing-filter

excluded? doesn't work with engines?

Closed this issue · 4 comments

I am unsure if there's something wrong with the way I'm trying to get this done. I'm Ruby 2.0.0-p0, Rails 3.2.13, using Spree 1.3.2

Here's a snippet of my routes.rb:

Project::Application.routes.draw do

  filter :locale, exclude: /^\/admin/

  match '/faq' => "faqs#index", as: "faq"
  mount Spree::Core::Engine, at: '/'

end

In locale.rb, in the excluded?(url) method, url is always '/' for all Spree links. This means that all links of the admin area get the locale prepended even if I have admin excluded via regex.
I could put the filter inside Spree:

Spree::Core::Engine.routes.prepend do
  filter :locale, exclude: /^\/admin/
end

But that would prevent me from having routes outside Spree that get the "locale" treatment.

+1
any updates on this?

spree_i18n includes routing-filter by default, (source), i've tried multiple things and the definition from spree_i18n is always called after my defs, overriding any exclude's set by my calls

no clue how to solve it

Doing some cleanup of my issues...