我試圖抓住UTF-8的URL。通常情況下,使用約束條件很好。對於網址:/international-delight-iced-coffee/
路由的工作原理:有限制的Rails路由
match ":post_name", :constraints => { :post_name => /.+/}}
一切都很好,在這裏。當它需要使用先進的約束條件時:
match ":post_name", :constraints => Post.new
# inside Post.rb
self.matches?(request)
puts ">>>> Arrived at matches!"
Post.find_by_name(request.path_parameters[:post_name])
end
self.matches
永遠不會被調用。任何想法如何使約束捕捉?
感謝先進! 賈斯汀