Sha256: fe20ce58376509b9c6b17387ebe547863af642a5aa9b11bc6918abf67eb6058e
Contents?: true
Size: 707 Bytes
Versions: 18
Compression:
Stored size: 707 Bytes
Contents
module Spotlight ## # Module that extends I18n::Backend::ActiveRecord::Translation to provide # additional Spotlight behavior, such as exhibit specific Translations module CustomTranslationExtension extend ActiveSupport::Concern included do default_scope { where(exhibit: current_exhibit) } belongs_to :exhibit, class_name: 'Spotlight::Exhibit', inverse_of: :translations before_validation do mark_for_destruction if value.blank? end end class_methods do def current_exhibit Thread.current[:current_exhibit] end def current_exhibit=(exhibit) Thread.current[:current_exhibit] = exhibit end end end end
Version data entries
18 entries across 18 versions & 1 rubygems