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
2009-10-11 23:24:57 -03:00

31 lines
863 B
Ruby

module Devise
module Controllers
module UrlHelpers
[:session, :password, :confirmation].each do |module_name|
[:path, :url].each do |path_or_url|
actions = [ nil, :new_ ]
actions << :edit_ if module_name == :password
actions.each do |action|
class_eval <<-URL_HELPERS
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
send("#{action}\#{resource}_#{module_name}_#{path_or_url}", *args)
end
URL_HELPERS
end
end
end
end
end
end