Sha256: 2bafdb5d71059d25e56da4210d1967fbfb40bc46e31a418d6d97241ac2c7b509

Contents?: true

Size: 561 Bytes

Versions: 15

Compression:

Stored size: 561 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 [Fixnum, 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

15 entries across 15 versions & 1 rubygems

Version Path
thredded-0.9.2 app/mailers/thredded/base_mailer.rb
thredded-0.9.1 app/mailers/thredded/base_mailer.rb
thredded-0.8.4 app/mailers/thredded/base_mailer.rb
thredded-0.8.2 app/mailers/thredded/base_mailer.rb
thredded-0.7.0 app/mailers/thredded/base_mailer.rb
thredded-0.6.3 app/mailers/thredded/base_mailer.rb
thredded-0.6.2 app/mailers/thredded/base_mailer.rb
thredded-0.6.1 app/mailers/thredded/base_mailer.rb
thredded-0.6.0 app/mailers/thredded/base_mailer.rb
thredded-0.5.1 app/mailers/thredded/base_mailer.rb
thredded-0.5.0 app/mailers/thredded/base_mailer.rb
thredded-0.4.0 app/mailers/thredded/base_mailer.rb
thredded-0.3.2 app/mailers/thredded/base_mailer.rb
thredded-0.3.1 app/mailers/thredded/base_mailer.rb
thredded-0.3.0 app/mailers/thredded/base_mailer.rb