How to make a public page in an app that uses the app
I am using an authentication program in a Rails 4 application. Nearly all applications require user authentication, but there are a few "public" pages (Terms and Conditions).
Come up with pages sign up
and sign in
using prepend_before_filter :require_no_authentication
. However, this method is only for developing controllers . And the development doesn't seem to provide the "correct" way to make individual actions public.
So what's the best way to make just a couple of actions public?
The only ways I can think of are:
-
To create a new namespace
public
and have separate controllers for public actions that inherit fromPublicController
which does notbefore_filter :authenticate_user!
-
Same as above, but inherit inheritance and namespace. Thus, it
PublicController
can act as a bucket for everything that should be publicly available, which is not much at this stage.
Is there a better way to make individual activities public using development?
source to share