method

from_attachable_sgid

rails latest stable - Class: ActionText::Attachable
from_attachable_sgid(sgid, options = {})
public

No documentation available.

# File actiontext/lib/action_text/attachable.rb, line 41
      def from_attachable_sgid(sgid, options = {})
        method = sgid.is_a?(Array) ? :locate_many_signed : :locate_signed
        record = GlobalID::Locator.public_send(method, sgid, options.merge(for: LOCATOR_NAME))
        record || raise(ActiveRecord::RecordNotFound)
      end

      private
        def attachable_from_sgid(sgid)
          from_attachable_sgid(sgid)
        rescue ActiveRecord::RecordNotFound
          nil
        end
    end