Template - Rails 7 view component Projet d'origine: Veracyte Stack: - Rails 7 - Ruby 3.1 - ViewComponent configuré comme on veut - Tailwind
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
rails_view_component/app/components/application_view_component.rb

14 lines
535 B

# frozen_string_literal: true
class ApplicationViewComponent < ViewComponentContrib::Base
extend Dry::Initializer
# It seems like there is an issue with the translation as we use them
# Because view_component_contrib defines a scope as array and then view_component expects a string
# the result is messed up. Here I override contrib's behaviour to keep a string
def self.i18n_scope
return @i18n_scope if defined?(@i18n_scope)
@i18n_scope = self.class.name.sub('::Component', '').underscore.tr('/', '.')
end
end