如何在Rails中显示记录时创建类似日期的URL?

时间:2016-01-03 19:52:52

标签: ruby-on-rails ruby-on-rails-4

如何以下列方式访问我的记录

enter image description here

而不是典型的$sql = 'INSERT INTO downloads AS d (nome, email, estado, arquivo, acessos) VALUES ($1, $2, $3, $4, 1) ON CONFLICT ON (nome, email) DO UPDATE SET acessos = EXCLUDED.acessos + 1'; 时尚?

1 个答案:

答案 0 :(得分:1)

您可以使用friendly-id gem。有关它的更多信息,请参见GitHub

railscasts中的教程: http://railscasts.com/episodes/314-pretty-urls-with-friendlyid?view=asciicast