Browse files

Move InternalHelpers to parent controller.

  • Loading branch information...
1 parent 0af2722 commit a29a30effcfd7421cd63daea21533831fa2c25f7 @josevalim josevalim committed Jan 2, 2012
View
1 Gemfile.lock
@@ -4,6 +4,7 @@ PATH
devise (2.0.0.rc)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
+ railties (~> 3.1)
warden (~> 1.1)
GEM
View
2 app/controllers/devise/confirmations_controller.rb
@@ -1,6 +1,4 @@
class Devise::ConfirmationsController < DeviseController
- include Devise::Controllers::InternalHelpers
-
# GET /resource/confirmation/new
def new
build_resource({})
View
2 app/controllers/devise/omniauth_callbacks_controller.rb
@@ -1,6 +1,4 @@
class Devise::OmniauthCallbacksController < DeviseController
- include Devise::Controllers::InternalHelpers
-
def failure
set_flash_message :alert, :failure, :kind => failed_strategy.name.to_s.humanize, :reason => failure_message
redirect_to after_omniauth_failure_path_for(resource_name)
View
1 app/controllers/devise/passwords_controller.rb
@@ -1,6 +1,5 @@
class Devise::PasswordsController < DeviseController
prepend_before_filter :require_no_authentication
- include Devise::Controllers::InternalHelpers
# GET /resource/password/new
def new
View
1 app/controllers/devise/registrations_controller.rb
@@ -1,7 +1,6 @@
class Devise::RegistrationsController < DeviseController
prepend_before_filter :require_no_authentication, :only => [ :new, :create, :cancel ]
prepend_before_filter :authenticate_scope!, :only => [:edit, :update, :destroy]
- include Devise::Controllers::InternalHelpers
# GET /resource/sign_up
def new
View
1 app/controllers/devise/sessions_controller.rb
@@ -1,7 +1,6 @@
class Devise::SessionsController < DeviseController
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
prepend_before_filter :allow_params_authentication!, :only => :create
- include Devise::Controllers::InternalHelpers
# GET /resource/sign_in
def new
View
1 app/controllers/devise/unlocks_controller.rb
@@ -1,6 +1,5 @@
class Devise::UnlocksController < DeviseController
prepend_before_filter :require_no_authentication
- include Devise::Controllers::InternalHelpers
# GET /resource/unlock/new
def new
View
1 app/controllers/devise_controller.rb
@@ -1,3 +1,4 @@
# All Devise controllers are inherited from here.
class DeviseController < ApplicationController
+ include Devise::Controllers::InternalHelpers
end
View
5 lib/devise/controllers/internal_helpers.rb
@@ -16,7 +16,7 @@ module InternalHelpers #:nodoc:
hide_action *helpers
helper_method *helpers
- prepend_before_filter :is_devise_resource?
+ prepend_before_filter :assert_is_devise_resource!
respond_to *Mime::SET.map(&:to_sym) if mimes_for_respond_to.empty?
end
@@ -54,7 +54,7 @@ def devise_controller?
protected
# Checks whether it's a devise mapped resource or not.
- def is_devise_resource? #:nodoc:
+ def assert_is_devise_resource! #:nodoc:
unknown_action! <<-MESSAGE unless devise_mapping
Could not find devise mapping for path #{request.fullpath.inspect}.
Maybe you forgot to wrap your route inside the scope block? For example:
@@ -91,6 +91,7 @@ def build_resource(hash=nil)
# Example:
# before_filter :require_no_authentication, :only => :new
def require_no_authentication
+ assert_is_devise_resource!
return unless is_navigational_format?
no_input = devise_mapping.no_input_strategies

0 comments on commit a29a30e

Please sign in to comment.