Created
June 21, 2011 01:18
-
-
Save jamescook/1037021 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/pages/lib/pages/marketable_routes.rb b/pages/lib/pages/marketable_routes.rb | |
index 4af9c28..f4c66c0 100644 | |
--- a/pages/lib/pages/marketable_routes.rb | |
+++ b/pages/lib/pages/marketable_routes.rb | |
@@ -4,10 +4,12 @@ | |
end | |
end | |
-# Add any parts of routes as reserved words. | |
-if ::Refinery::Page.use_marketable_urls? | |
- route_paths = ::Refinery::Application.routes.named_routes.routes.map{|name, route| route.path} | |
- ::Refinery::Page.friendly_id_config.reserved_words |= route_paths.map { |path| | |
- path.to_s.gsub(/^\//, '').to_s.split('(').first.to_s.split(':').first.to_s.split('/') | |
- }.flatten.reject{|w| w =~ /\_/}.uniq | |
+::Refinery::Application.config.after_initialize do | |
+ # Add any parts of routes as reserved words. | |
+ if ::Refinery::Page.use_marketable_urls? | |
+ route_paths = ::Refinery::Application.routes.named_routes.routes.map{|name, route| route.path} | |
+ ::Refinery::Page.friendly_id_config.reserved_words |= route_paths.map { |path| | |
+ path.to_s.gsub(/^\//, '').to_s.split('(').first.to_s.split(':').first.to_s.split('/') | |
+ }.flatten.reject{|w| w =~ /\_/}.uniq | |
+ end | |
end |
Well it's added to the route reloader's path in an initializer, I don't know that means its being required.
Ah, good call.
this is the best fix for me so far.....
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
after_initialize only fires once in development mode, right? Isn't this file already run from within an initializer? :)