Skip to content

Instantly share code, notes, and snippets.

@jamescook
Created June 21, 2011 01:18
Show Gist options
  • Save jamescook/1037021 to your computer and use it in GitHub Desktop.
Save jamescook/1037021 to your computer and use it in GitHub Desktop.
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
@parndt
Copy link

parndt commented Jun 21, 2011

Ah, good call.

@knewter
Copy link

knewter commented Jun 21, 2011

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