Sha256: 451666ec15a25299a3334d468be497f62dab0fef4a18f93e0be9b997c825bf13
Contents?: true
Size: 634 Bytes
Versions: 7
Compression:
Stored size: 634 Bytes
Contents
# Load field names for custom fields, for Ransack search if Setting.database_and_table_exists? Rails.application.config.after_initialize do I18n.backend.load_translations translations = { ransack: { attributes: {} } } CustomField.find_each do |custom_field| if custom_field.field_group.present? model_key = custom_field.klass.model_name.singular translations[:ransack][:attributes][model_key] ||= {} translations[:ransack][:attributes][model_key][custom_field.name] = custom_field.label end end I18n.backend.store_translations(Setting.locale.to_sym, translations) end end
Version data entries
7 entries across 7 versions & 2 rubygems