Created
February 23, 2015 00:48
-
-
Save mecampbellsoup/2c2d8c8a08b24481540e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class FlybladeController < ApplicationController | |
| def check_terms_of_service_version | |
| return if request.path == edit_user_path(current_user) | |
| version = Flyblade::TermsOfServicePolicy.current_version | |
| unless current_user.terms_of_service_version == version | |
| return redirect_to edit_user_path(current_user) | |
| end | |
| end | |
| end |
What do you think of the following?
- Add
validates_acceptance_of: terms_of_servicetoUser - Add
terms_of_servicefield to the new user form - When a new user is saved, persist the terms of service based on
Flyblade::TermsOfServicePolicy.current_version - Have a before_action that checks the user has accepted most recent terms of service (if not, redirect to standalone terms of service form)
Author
skip_before_action :check_terms_of_service_version, only: [:edit, :update]
Needed on update as well right?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think you can omit line 3 if you just skip the method for the edit user action.
skip_before_action :check_terms_of_service_version, only: [:edit]