You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a project we use a scope in routes for language switching, which includes the commontator mount:
scope path: '(:locale)', constraints: { locale: /#{I18n.available_locales.join("|")}/ } do
mount Commontator::Engine => '/commontator'
# ...
end
We had to customize ApplicationController and SubscriptionMailer due to routing errors in using url helpers:
class Commontator::ApplicationController < ActionController::Base
before_action :set_locale
def set_locale
I18n.locale = params[:locale] || I18n.default_locale
end
def url_options(options = {})
options.merge(locale: I18n.locale, only_path: true)
end
# ...
end
class Commontator::SubscriptionsMailer < ActionMailer::Base
def url_options
{ locale: I18n.locale }.merge(super)
end
# ...
end
In particular, Commontator failed to send notifications of new comments, because the :locale parameter was filled with the commontable object, resulting in the error: "No route matches ... missing required keys: [: id]".
Also, after creating a comment, the current :locale was not passed and translations in the default language appeared.
The text was updated successfully, but these errors were encountered:
In a project we use a scope in routes for language switching, which includes the commontator mount:
We had to customize ApplicationController and SubscriptionMailer due to routing errors in using url helpers:
In particular, Commontator failed to send notifications of new comments, because the :locale parameter was filled with the commontable object, resulting in the error: "No route matches ... missing required keys: [: id]".
Also, after creating a comment, the current :locale was not passed and translations in the default language appeared.
The text was updated successfully, but these errors were encountered: