문제

I have a blog app that use Friendly_id gem and but when I use Japanese Character in the title and go to article show i have a url like this http://www.blog.com/articles/8. but i want to get url which is mapped to japanese letters or latin letters, how can i do it

올바른 솔루션이 없습니다

다른 팁

So there is this solution has been suggested: FriendlyID Korean slugs

however I tend to prefer a solution with : http://www.rubydoc.info/gems/unidecode

gem 'unidecode'
# ...
extend FriendlyId
friendly_id :nickname_ascii, use: :slugged
# using gem unidecode
def nickname_ascii
  nickname.to_ascii
end

Good enough for kana but quite bad for Kanji

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top