【发布时间】:2016-03-26 00:32:31
【问题描述】:
我注意到docs 上写着:Previous versions of FriendlyId appended a numeric sequence to make slugs unique, but this was removed to simplify using FriendlyId in concurrent code.
有没有办法恢复到这种格式?我的模型只有name,因此没有任何其他可行的slug 候选者并且(time 或date 在这种情况下对于slug 候选者没有意义)。
我怎样才能改变这个(当前格式):
car.friendly_id #=> "peugeot-206"
car2.friendly_id #=> "peugeot-206-f9f3789a-daec-4156-af1d-fab81aa16ee5"
car3.friendly_id #=> "peugeot-206-f9dsafad-eamj-2091-a3de-fabsafafdsa5"
进入这个:
car.friendly_id #=> "peugeot-206"
car2.friendly_id #=> "peugeot-206-1"
car3.friendly_id #=> "peugeot-206-2"
【问题讨论】: