1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00
heartcombo--devise/lib/devise/controllers/url_helpers.rb

32 lines
863 B
Ruby
Raw Normal View History

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
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
end
2009-10-11 21:11:58 -04:00
send("#{action}\#{resource}_#{module_name}_#{path_or_url}", *args)
end
URL_HELPERS
end
end
end
2009-10-11 21:11:58 -04:00
end
end
end