31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/svelte_on_rails/active_record_extensions.rb', line 31
def to_svelte(*attributes, **associations)
conf = SvelteOnRails::Configuration.instance
conf.to_svelte_benchmark_log("Model extracted") do
cache_key = (I18n.locale.to_s + self.name + attributes.to_s + associations.to_s).hash
tsl = SvelteOnRails::Lib::ToSvelteSchema.instance
tnl = SvelteOnRails::Lib::ToSvelteTranslations.instance
models, schema = tsl.(self, attributes, associations, cache_key)
translations = tnl.all_cached_translations(I18n.locale, :to_svelte_props, models, self)
schema.merge(translations)
end
end
|