Updated How To: Create a guest user (markdown)
fix small grammatical error for clarification
Rails still has the associations to the guest_user cached after calling 'logging_in'. If the User model has a 'dependent: :destroy' parameter the associations will be deleted even if the user is changed. Reloading the guest user before destroying makes sure rails pick up the changes.
rm unnecessary profanity
the guest user code has two bugs: 1. with the warden strategy, it's possible for the current_user to be the guest_user, thus we need to check whether guest_user_id is equal to current_user.id to prevent it from being destroyed. 2. there is a possibility that we are unnecessarily creating then destroying a guest user
Fix `rand` in code so the upper bound is 99 instead of 98
Finder in authentication strategy could raise when guest record doesn't exist
Adds in a method for authenticating the guest user
Wrapped guest_user function in begin block for rescue. Additionally signed in guest user in the guest user function
Changed :receive_guess to :receive_guest. Pretty sure that's a spelling error.
Lack of checking return value from save method. Caching of guest_user instead of fetching it every time.
saves session[:guest_user_id] on create_guest_user method, to avoid multiple user creations in same session
Added instruction to make method available to views
Use `||=` idiom to create a guest user.
Had an extra 'end' (copy-paste error)
Added some (commented out) logging_in example code. Made logging_in private.
change generated email address to 'example.com' per RFC2606
Changed u.save(false) to u.save(:validate => false) for rails 3 compability
The first approach really has many bugs (for example ApplicationHelper should be used from the view), it's just wasting time for other people
Created How To: Create a guest user (markdown)