Method: ActionDispatch::Routing::Mapper#authenticate

Defined in:
lib/devise/rails/routes.rb

#authenticate(scope) ⇒ Object

Allow you to add authentication request from the router:

authenticate(:user) do
  resources :post
end


169
170
171
172
173
174
175
176
177
# File 'lib/devise/rails/routes.rb', line 169

def authenticate(scope)
  constraint = lambda do |request|
    request.env["warden"].authenticate!(:scope => scope)
  end

  constraints(constraint) do
    yield
  end
end