-2
我的代碼是這樣的:如何改變我訪問Rails的文章對象
article_path(Article.first) - 'http://localhost:3000/articles/1063'
get 'articles/:id', to: 'articles#show', as: 'article'
我想改變這樣的:
article_path(Article.first) - 'http://localhost:3000/articles/article-title-1063'
get 'articles/:id', to: 'articles#show', as: 'article' , id: /some_regex/
你可能想檢查'friendly-id' –
而我認爲不是'http:// localhost:3000/articles/article-title-1063''你應該去http:// localhost: 3000 /用品/ 1063 /條,title'' –