Sha256: da6782ce1ca550d17ae07c2cf32fcb994b1f7887121742ad4b6e0014b56a97d1

Contents?: true

Size: 578 Bytes

Versions: 4

Compression:

Stored size: 578 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

4 entries across 4 versions & 1 rubygems

Version Path
thredded-0.12.1 app/mailers/thredded/base_mailer.rb
thredded-0.12.0 app/mailers/thredded/base_mailer.rb
thredded-0.11.1 app/mailers/thredded/base_mailer.rb
thredded-0.11.0 app/mailers/thredded/base_mailer.rb