私の宝石ファイルには、gem 'stringex'. を実行した後bundle install、パス ヘルパーを追加し、stringex のメソッドを使用しています。to_urlstringex readme: の例のように、文字列に対して直接使用できるはずです"simple English".to_url => "simple-english"。
ただし、パスヘルパーの文字列でメソッド .to_url を使用しようとすると、次のようになります。
undefined method 'to_url' for "fake title":String
私のヘルパーメソッドは次のようになります。
module PostsHelper
def post_path(post)
"/posts/#{post.id}/#{post.title.to_url}"
end
end