config/routes.rb in cardboard_cms-0.2.1 vs config/routes.rb in cardboard_cms-0.2.2
- old
+ new
@@ -19,15 +19,18 @@
#Don't put a root path here, use "/" instead... (to be able to use root_path in the pages)
scope as: 'cardboard' do
#generate routes for custom cardboard resources controllers
- Cardboard.resource_controllers.map{|x|x.controller_name}.each do |controller|
- if controller.singularize == controller && controller.pluralize != controller
- resource controller #singular controller
+ Cardboard.resource_controllers.each do |controller|
+ if controller.singular?
+ # Singular controller names are non-standard in rails. We must specify the
+ # controller explicitly here to keep the name from
+ # being pluralized in the route.
+ resource controller.controller_name, controller: controller.controller_name
else
- resources controller
+ resources controller.controller_name
end
end
end
end
@@ -50,6 +53,6 @@
def page_url(identifier, options = {})
return nil unless url = page_path(identifier, options)
root_url + url[1..-1]
end
-end
\ No newline at end of file
+end