lib/paper_trail/reifier.rb
# See `VersionConcern#reify` for documentation.
# @api private
See `VersionConcern#reify` for documentation.
See ` VersionConcern#reify ` for documentation .
def reify_has_and_belongs_to_many(transaction_id, model, options = {})
        model.class.reflect_on_all_associations(:has_and_belongs_to_many).each do |assoc|
          papertrail_enabled = assoc.klass.paper_trail.enabled?
          next unless
            model.class.paper_trail_save_join_tables.include?(assoc.name) ||
                papertrail_enabled
          version_ids = PaperTrail::VersionAssociation.
            where("foreign_key_name = ?", assoc.name).
            where("version_id = ?", transaction_id).
            pluck(:foreign_key_id)
          model.send(assoc.name).proxy_association.target =
            version_ids.map do |id|
              if papertrail_enabled
                version = load_version_for_habtm(
                  assoc,
                  id,
                  transaction_id,
                  options[:version_at]
                )
                if version
                  next version.reify(
                    options.merge(
                      has_many: false,
                      has_one: false,
                      belongs_to: false,
                      has_and_belongs_to_many: false
                    )
                  )
                end
              end
              assoc.klass.where(assoc.klass.primary_key => id).first
            end
        end
      end
def reify_has_and_belongs_to_many ( transaction_id , model , options = { } ) model . class . reflect_on_all_associations ( :has_and_belongs_to_many ) . each do | assoc | papertrail_enabled = assoc . klass . paper_trail . enabled? next unless model . class . paper_trail_save_join_tables . include? ( assoc . name ) || papertrail_enabled version_ids = PaperTrail :: VersionAssociation . where ( "foreign_key_name = ?" , assoc . name ) . where ( "version_id = ?" , transaction_id ) . pluck ( :foreign_key_id ) model . send ( assoc . name ) . proxy_association . target = version_ids . map do | id | if papertrail_enabled version = load_version_for_habtm ( assoc , id , transaction_id , options [ :version_at ] ) if version next version . reify ( options . merge ( has_many : false , has_one : false , belongs_to : false , has_and_belongs_to_many : false ) ) end end assoc . klass . where ( assoc . klass . primary_key => id ) . first end end end
See `VersionConcern#reify` for documentation.
See ` VersionConcern#reify ` for documentation .
transaction_id
<not_specific>
model
<not_specific>
options
<not_specific>
api
None