Sha256: 08b830b6eef424900b39deaf67608a6dad9bf97437c7f2035925b15112c04cf0

Contents?: true

Size: 718 Bytes

Versions: 11

Compression:

Stored size: 718 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[:masqueraded_resource_class] = resource.class.name

        opts[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[:masqueraded_resource_class] = resource.class.name

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

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
devise_masquerade-2.1.3 lib/devise_masquerade/controllers/url_helpers.rb
devise_masquerade-2.1.2 lib/devise_masquerade/controllers/url_helpers.rb
devise_masquerade-2.1.0 lib/devise_masquerade/controllers/url_helpers.rb
devise_masquerade-2.0.3 lib/devise_masquerade/controllers/url_helpers.rb
devise_masquerade-2.0.2 lib/devise_masquerade/controllers/url_helpers.rb
devise_masquerade-2.0.1 lib/devise_masquerade/controllers/url_helpers.rb
devise_masquerade-2.0.0 lib/devise_masquerade/controllers/url_helpers.rb
devise_masquerade-1.3.12 lib/devise_masquerade/controllers/url_helpers.rb
devise_masquerade-1.3.11 lib/devise_masquerade/controllers/url_helpers.rb
devise_masquerade-1.3.10 lib/devise_masquerade/controllers/url_helpers.rb
devise_masquerade-1.3.9 lib/devise_masquerade/controllers/url_helpers.rb