开发者

Puzzling over my routes.rb file

开发者 https://www.devze.com 2023-02-19 16:24 出处:网络
I am writing a Rails app that I partially inherited. There is a snippet of code in the routes.rb that I\'m trying to puzzle out and can\'t find anything in the documentation.

I am writing a Rails app that I partially inherited. There is a snippet of code in the routes.rb that I'm trying to puzzle out and can't find anything in the documentation.

  authenticate :users do 
    resources :authentications
  end

What does this do and why is it needed here? I'd never seen the authenticate used in this context bef开发者_C百科ore. There are resources called users and authentications in the file, and I am using Devise+OmniAuth for authentication.


As seen here in the Devise Docs, it allows you to add authentication at the router level rather than at the application level(aka controllers, essentially).

0

精彩评论

暂无评论...
验证码 换一张
取 消