Module: Decidim::TranslatableAttributes
- Extended by:
- ActiveSupport::Concern
- Included in:
- AdminLog::ModerationPresenter, Amendable::Form, Authorable, BaseDiffRenderer, Component, ComponentAttachmentCollectionPresenter, DownloadYourDataExporter, DownloadYourDataSerializers::DownloadYourDataUserSerializer, Exporters::PDF, FormBuilder, MetaImageUrlResolver, NotificationToMailerPresenter, OpenDataExporter, OrganizationHelper, PayloadInfo, ResourcePresenter, TaxonomiesHelper, TranslationsHelper
- Defined in:
- lib/decidim/translatable_attributes.rb
Overview
A set of convenience methods to deal with I18n attributes and validations in a way that is compatible with AttributeObject and ActiveModel, thus making it easy to integrate into Rails’ forms and similar workflows.
Instance Method Summary collapse
Instance Method Details
#attachment?(value) ⇒ Boolean
131 132 133 |
# File 'lib/decidim/translatable_attributes.rb', line 131 def (value) value.is_a?(String) && value.include?(ActiveStorage.routes_prefix) end |
#default_locale?(locale) ⇒ Boolean
126 127 128 129 |
# File 'lib/decidim/translatable_attributes.rb', line 126 def default_locale?(locale) locale.to_s == try(:default_locale).to_s || locale.to_s == try(:current_organization).try(:default_locale).to_s end |