svenfuchs / routing-filter

routing-filter wraps around the complex beast that the Rails routing system is, allowing for unseen flexibility and power in Rails URL recognition and generation.
http://www.artweb-design.de
MIT License
464 stars 84 forks source link

excluded? doesn't work with engines? #46

Closed amencarini closed 7 years ago

amencarini commented 11 years ago

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.

lukemorton commented 10 years ago

+1

nimashariatian commented 10 years ago

+1 any updates on this?

jumski commented 8 years ago

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

amencarini commented 7 years ago

Doing some cleanup of my issues...