Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Move InternalHelpers to parent controller.

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

0 comments on commit a29a30e

Please sign in to comment.
Something went wrong with that request. Please try again.