lib/moxify.rb in moxify-0.1.7.2 vs lib/moxify.rb in moxify-0.1.7.3
- old
+ new
@@ -30,20 +30,22 @@
# override routes
collected_routes = []
Rails.application.routes.routes.each do |route|
match = false
- if route.path =~ /refinery/ and
+ if RefinerySetting.find_or_set(:rewrite_refinery_paths, true) and
+ route.path =~ /refinery/ and
not route.path =~ /^\/refinery\(\/\*path\)/ # this is our catch all route
- route.instance_variable_set "@path", route.path.gsub(/refinery/, "admin")
+ route.instance_variable_set "@path", route.path.gsub(/refinery/, RefinerySetting.find_or_set(:rewrite_refinery_paths_to, "admin"))
match = true
- elsif route.path =~ /^\/users/ and
+ elsif RefinerySetting.find_or_set(:rewrite_user_paths, true) and
+ route.path =~ /^\/users/ and
route.name =~ /user\_/
- route.instance_variable_set "@path", route.path.gsub(/users/, "admin")
+ route.instance_variable_set "@path", route.path.gsub(/users/, RefinerySetting.find_or_set(:rewrite_user_paths_to, "admin"))
match = true
end
if match
@@ -74,6 +76,6 @@
end
end
-end
+end
\ No newline at end of file