Sha256: 2611fbf67f3334f9bf7d0b004163eaa3f7102d218a0f0ccb337c5c3b69350e61

Contents?: true

Size: 562 Bytes

Versions: 4

Compression:

Stored size: 562 Bytes

Contents

# frozen_string_literal: true
module Thredded
  class BaseMailer < ActionMailer::Base
    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.10.1 app/mailers/thredded/base_mailer.rb
thredded-0.10.0 app/mailers/thredded/base_mailer.rb
thredded-0.9.4 app/mailers/thredded/base_mailer.rb
thredded-0.9.3 app/mailers/thredded/base_mailer.rb