Sha256: 1caef2a8f3b6fa1d12fc0a17a506d347306044ddcf3e4a2cab9cc6b2da8b5b93

Contents?: true

Size: 579 Bytes

Versions: 42

Compression:

Stored size: 579 Bytes

Contents

# frozen_string_literal: true

module Thredded
  class BaseMailer < Thredded.parent_mailer.constantize
    helper ::Thredded::UrlsHelper

    protected

    # Find a record by ID, or return the passed record.
    # @param [Class<ActiveRecord::Base>] klass
    # @param [Integer, String, klass] id_or_record
    # @return [klass]
    def find_record(klass, id_or_record)
      # Check by name because in development the Class might have been reloaded after id was initialized
      id_or_record.class.name == klass.name ? id_or_record : klass.find(id_or_record)
    end
  end
end

Version data entries

42 entries across 42 versions & 2 rubygems

Version Path
thredded-1.1.0 app/mailers/thredded/base_mailer.rb
thredded-1.0.1 app/mailers/thredded/base_mailer.rb
thredded-1.0.0 app/mailers/thredded/base_mailer.rb
thredded-0.16.16 app/mailers/thredded/base_mailer.rb
thredded-0.16.15 app/mailers/thredded/base_mailer.rb
thredded-0.16.14 app/mailers/thredded/base_mailer.rb
thredded-0.16.13 app/mailers/thredded/base_mailer.rb
thredded-0.16.12 app/mailers/thredded/base_mailer.rb
thredded-0.16.11 app/mailers/thredded/base_mailer.rb
thredded-0.16.10 app/mailers/thredded/base_mailer.rb
thredded-0.16.9 app/mailers/thredded/base_mailer.rb
thredded-0.16.8 app/mailers/thredded/base_mailer.rb
thredded-0.16.7 app/mailers/thredded/base_mailer.rb
thredded-0.16.6 app/mailers/thredded/base_mailer.rb
thredded-0.16.5 app/mailers/thredded/base_mailer.rb
thredded-0.16.4 app/mailers/thredded/base_mailer.rb
thredded-0.16.3 app/mailers/thredded/base_mailer.rb
thredded-0.16.1 app/mailers/thredded/base_mailer.rb
thredded-0.16.0 app/mailers/thredded/base_mailer.rb
thredded-0.15.5 app/mailers/thredded/base_mailer.rb