Don't update user
Andrew Kane
committed Apr 23, 2014
commit 3673768b08ef0ed9473094f9d3b3db3a1301a0ed
Showing 2
changed files with
3 additions
and 3 deletions
README.md
+2
-2
| @@ | @@ -96,8 +96,8 @@ With [Devise](https://github.com/plataformatec/devise), it will attach the user |
| With other authentication frameworks, add this to the end of your sign in method: | |
| ```ruby | |
| - | if current_visit |
| - | current_visit.user ||= current_user |
| + | if current_visit and !current_visit.user |
| + | current_visit.user = current_user |
| current_visit.save! | |
| end | |
| ``` | |
ahoy_matey.rb b/lib/ahoy_matey.rb
+1
-1
| @@ | @@ -35,7 +35,7 @@ if defined?(Warden) |
| visit_token = request.cookies["ahoy_visit"] || request.headers["Ahoy-Visit"] | |
| if visit_token | |
| visit = Ahoy.visit_model.where(visit_token: visit_token).first | |
| - | if visit |
| + | if visit and !visit.user |
| visit.user = user | |
| visit.save! | |
| end | |