lib/devise/rails/routes.rb in devise-3.2.4 vs lib/devise/rails/routes.rb in devise-3.3.0
- old
+ new
@@ -127,11 +127,12 @@
# accessing devise/sessions, devise/registrations, and so on). If you want
# to namespace all at once, use module:
#
# devise_for :users, module: "users"
#
- # * skip: tell which controller you want to skip routes from being created:
+ # * skip: tell which controller you want to skip routes from being created.
+ # It accepts :all as an option, meaning it will not generate any route at all:
#
# devise_for :users, skip: :sessions
#
# * only: the opposite of :skip, tell which controllers only to generate routes to:
#
@@ -151,10 +152,12 @@
#
# * constraints: works the same as Rails' constraints
#
# * defaults: works the same as Rails' defaults
#
+ # * router_name: allows application level router name to be overwritten for the current scope
+ #
# ==== Scoping
#
# Following Rails 3 routes DSL, you can nest devise_for calls inside a scope:
#
# scope "/my" do
@@ -222,26 +225,25 @@
begin
raise_no_devise_method_error!(mapping.class_name) unless mapping.to.respond_to?(:devise)
rescue NameError => e
raise unless mapping.class_name == resource.to_s.classify
- warn "[WARNING] You provided devise_for #{resource.inspect} but there is " <<
+ warn "[WARNING] You provided devise_for #{resource.inspect} but there is " \
"no model #{mapping.class_name} defined in your application"
next
rescue NoMethodError => e
raise unless e.message.include?("undefined method `devise'")
raise_no_devise_method_error!(mapping.class_name)
end
if options[:controllers] && options[:controllers][:omniauth_callbacks]
unless mapping.omniauthable?
- msg = "Mapping omniauth_callbacks on a resource that is not omniauthable\n"
- msg << "Please add `devise :omniauthable` to the `#{mapping.class_name}` model"
- raise msg
+ raise ArgumentError, "Mapping omniauth_callbacks on a resource that is not omniauthable\n" \
+ "Please add `devise :omniauthable` to the `#{mapping.class_name}` model"
end
end
- routes = mapping.used_routes
+ routes = mapping.used_routes
devise_scope mapping.name do
with_devise_exclusive_scope mapping.fullpath, mapping.name, options do
routes.each { |mod| send("devise_#{mod}", mapping, mapping.controllers) }
end