lib/cadmus/routing.rb in cadmus-0.4.4 vs lib/cadmus/routing.rb in cadmus-0.4.6

- old
+ new

@@ -14,11 +14,11 @@ # assert_recognizes doesn't pass the full params hash as we would in a real Rails # application. So we have to always pass this constraint if we're testing. return true if page_glob.nil? && Rails.env.test? - page_glob.sub(/^\//, '').split(/\//).all? do |part| + page_glob.sub(/\A\//, '').split(/\//).all? do |part| part =~ /\A[a-z][a-z0-9\-]*\z/ end end end end @@ -53,10 +53,10 @@ slug_constraint = Cadmus::SlugConstraint.new page_actions = Proc.new do get "*page_glob/edit" => "#{controller}#edit", :as => 'edit_page', :constraints => slug_constraint get "*page_glob" => "#{controller}#show", :as => 'page', :constraints => slug_constraint - put "*page_glob" => "#{controller}#update", :constraints => slug_constraint + match "*page_glob" => "#{controller}#update", :constraints => slug_constraint, :via => [:put, :patch] delete "*page_glob" => "#{controller}#destroy", :constraints => slug_constraint end if options[:shallow] instance_eval(&page_actions)