We have website with adult content. If user visit site first time, we need to show him message “If you’re 18 years old you can enter.” and “Enter” button. How can I show this page once and if user click on enter, show him homepage?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is an ideal situation to store something in the user’s session, and redirect them based on whether or not that something is set. Have a
before_filterin yourapplication_controller.rbthat looks like this:In your age verification controller, set
session[:age_check]to true if the user clicks on a link. Then thebefore_filterwill let them access the site as you’d expect.