Skip to content

Instantly share code, notes, and snippets.

@stigi
Created September 29, 2012 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stigi/3805319 to your computer and use it in GitHub Desktop.
Save stigi/3805319 to your computer and use it in GitHub Desktop.
module DeviseUrlWorkaroundHelper
def session_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("#{scope}_session_path", *args)
end
def new_session_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("new_#{scope}_session_path", *args)
end
def destroy_session_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("destroy_#{scope}_session_path", *args)
end
def session_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("#{scope}_session_url", *args)
end
def new_session_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("new_#{scope}_session_url", *args)
end
def destroy_session_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("destroy_#{scope}_session_url", *args)
end
def password_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("#{scope}_password_path", *args)
end
def new_password_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("new_#{scope}_password_path", *args)
end
def edit_password_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("edit_#{scope}_password_path", *args)
end
def password_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("#{scope}_password_url", *args)
end
def new_password_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("new_#{scope}_password_url", *args)
end
def edit_password_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("edit_#{scope}_password_url", *args)
end
def registration_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("#{scope}_registration_path", *args)
end
def new_registration_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("new_#{scope}_registration_path", *args)
end
def edit_registration_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("edit_#{scope}_registration_path", *args)
end
def cancel_registration_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("cancel_#{scope}_registration_path", *args)
end
def registration_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("#{scope}_registration_url", *args)
end
def new_registration_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("new_#{scope}_registration_url", *args)
end
def edit_registration_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("edit_#{scope}_registration_url", *args)
end
def cancel_registration_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("cancel_#{scope}_registration_url", *args)
end
def confirmation_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("#{scope}_confirmation_path", *args)
end
def new_confirmation_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("new_#{scope}_confirmation_path", *args)
end
def confirmation_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("#{scope}_confirmation_url", *args)
end
def new_confirmation_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("new_#{scope}_confirmation_url", *args)
end
def unlock_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("#{scope}_unlock_path", *args)
end
def new_unlock_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("new_#{scope}_unlock_path", *args)
end
def unlock_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("#{scope}_unlock_url", *args)
end
def new_unlock_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("new_#{scope}_unlock_url", *args)
end
def session_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("#{scope}_session_path", *args)
end
def new_session_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("new_#{scope}_session_path", *args)
end
def destroy_session_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("destroy_#{scope}_session_path", *args)
end
def session_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("#{scope}_session_url", *args)
end
def new_session_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("new_#{scope}_session_url", *args)
end
def destroy_session_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("destroy_#{scope}_session_url", *args)
end
def confirmation_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("#{scope}_confirmation_path", *args)
end
def new_confirmation_path(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("new_#{scope}_confirmation_path", *args)
end
def confirmation_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("#{scope}_confirmation_url", *args)
end
def new_confirmation_url(resource_or_scope, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("new_#{scope}_confirmation_url", *args)
end
end
@stigi
Copy link
Author

stigi commented Sep 29, 2012

As unDRY as it gets ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment