Вопрос

I'm using friendly_id gem in my app. How can I get object's friendly id? When I write @post.id I get 1 but how can I get first_post instead?

Это было полезно?

Решение

There should a method called friendly_id

@post.id # => 1
@post.friendly_id # => first_post

Hope this helps

Другие советы

Alternative to @post.friendly_id:

@post.slug # => first_post
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top