Sha256: b8be391223ba1b9058f11087ec2a9556d9ebccbac9c5e392f523e64dd95679f5

Contents?: true

Size: 736 Bytes

Versions: 8

Compression:

Stored size: 736 Bytes

Contents

require 'securerandom'

module DeviseMasquerade
  module Controllers

    module UrlHelpers
      def masquerade_path(resource, *args)
        scope = Devise::Mapping.find_scope!(resource)

        opts = args.shift || {}
        opts.merge!(masqueraded_resource_class: resource.class.name)

        opts.merge!(Devise.masquerade_param => resource.masquerade_key)

        send("#{scope}_masquerade_index_path", opts, *args)
      end

      def back_masquerade_path(resource, *args)
        scope = Devise::Mapping.find_scope!(resource)

        opts = args.first || {}
        opts.merge!(masqueraded_resource_class: resource.class.name)

        send("back_#{scope}_masquerade_index_path", opts, *args)
      end
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
devise_masquerade-1.3.8 lib/devise_masquerade/controllers/url_helpers.rb
devise_masquerade-1.3.7 lib/devise_masquerade/controllers/url_helpers.rb
devise_masquerade-1.3.6 lib/devise_masquerade/controllers/url_helpers.rb
devise_masquerade-1.3.5 lib/devise_masquerade/controllers/url_helpers.rb
devise_masquerade-1.3.4 lib/devise_masquerade/controllers/url_helpers.rb
devise_masquerade-1.3.3 lib/devise_masquerade/controllers/url_helpers.rb
devise_masquerade-1.3.2 lib/devise_masquerade/controllers/url_helpers.rb
devise_masquerade-1.3.1 lib/devise_masquerade/controllers/url_helpers.rb