2009-10-09 20:11:58 -04:00
|
|
|
module Devise
|
|
|
|
module Controllers
|
|
|
|
module UrlHelpers
|
|
|
|
|
|
|
|
[:session, :password, :confirmation].each do |module_name|
|
|
|
|
[:path, :url].each do |path_or_url|
|
2009-10-11 21:11:58 -04:00
|
|
|
actions = [ nil, :new_ ]
|
|
|
|
actions << :edit_ if module_name == :password
|
|
|
|
|
2009-10-09 20:11:58 -04:00
|
|
|
actions.each do |action|
|
|
|
|
class_eval <<-URL_HELPERS
|
2009-10-11 21:11:58 -04:00
|
|
|
def #{action}#{module_name}_#{path_or_url}(resource, *args)
|
|
|
|
resource = case resource
|
|
|
|
when Symbol, String
|
|
|
|
resource
|
|
|
|
when Class
|
|
|
|
resource.name.underscore
|
|
|
|
else
|
|
|
|
resource.class.name.underscore
|
2009-10-11 07:15:48 -04:00
|
|
|
end
|
2009-10-11 21:11:58 -04:00
|
|
|
|
|
|
|
send("#{action}\#{resource}_#{module_name}_#{path_or_url}", *args)
|
2009-10-09 20:11:58 -04:00
|
|
|
end
|
|
|
|
URL_HELPERS
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2009-10-11 21:11:58 -04:00
|
|
|
|
2009-10-09 20:11:58 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|