My Post
model uses translates
method from globalize
gem and friendly_id
to gerenate more user friendly urls.
When I create my post in my native language it gets added. Accessing it after switching to en
locale makes it fallback for the native translation, as it does not have any. How can I achieve this with friendlyID
? I mean, the slug
for current locale is generated correctly, but it is still nil
for the other locales.
class Post < ApplicationRecord
# Translations
translates :title, :body, :slug
# FriendlyID
extend FriendlyId
friendly_id :title, use: :slugged
end