Sha256: cb95f7930222e73fdd2131acbe1c3bf1c0d775eef543a00681547296248460ab

Contents?: true

Size: 711 Bytes

Versions: 1

Compression:

Stored size: 711 Bytes

Contents

module DeviseInvitable
  module Controllers
    module UrlHelpers
      [:path, :url].each do |path_or_url|
        [nil, :new_, :edit_].each do |action|
          class_eval <<-URL_HELPERS, __FILE__, __LINE__ + 1
            def #{action}invitation_#{path_or_url}(resource, *args)
              resource = case resource
                when Symbol, String
                  resource
                when Class
                  resource.name.underscore
                else
                  resource.class.name.underscore
              end
              
              send("#{action}\#{resource}_invitation_#{path_or_url}", *args)
            end
          URL_HELPERS
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lperichon-devise_invitable-0.3.0 lib/devise_invitable/controllers/url_helpers.rb