How about doing something like this ...
How do you want to allow unauthenticated access to the main application page only:
This is how I like to set up my application
1) in the route file
# config / routes.rb
Rails.application.routes.draw do
ide_for: users,: controllers => {registrações: 'users / registrations',
sessões: 'usuários / sessões',
senhas: 'usuários / senhas',
confirmações: 'usuários / confirmações'
}
autenticar: o usuário faz
namespace: os usuários fazem
recursos: posts
root: to => 'channels # index'
fim
fim
recursos: contats
match "/ about_us" => "pages # about_us",: as =>: about_us, via:: todos
Páginas de raiz # índice '
fim
In this way, all routes that are outside the namespace ** are public users
I also create a master user controller that the application controller extended as well
# app / controllers / user_controller.rb
classe UserController <ApplicationController
before_filter: authenticate_user!
fim
Now for all device drivers
# app / controllers / users / registrations_controller.rb
Usuários da classe :: RegistrationsController <Devise :: RegistrationsController
privado
def after_sign_in_path_for (usuário)
user_root_path
fim
fim
The entire controller of my users extends my user controller
# app / controllers / users / posts_controller.rb
classe Usuários :: PostsController <UserController
...
fim
You can follow this format for all other drivers. If you still need help, let me know.