I am using the obfuscate_id gem ( https://github.com/namick/obfuscate_id ).
We obfuscate ID's by inserting one line into the top of each model:
@current_user ||= User.find(session[:user_id]) if session[:user_id]
Couldn't find User with id=5164061535
class User < ActiveRecord::Base
# This part obfuscates the user ID
has_one :profile, dependent: :destroy
has_many :replies, through: :pins
Weirdly enough, I ended up trying this:
@current_user ||= User.find_by_id(session[:user_id]) if session[:user_id]
And it worked! But, why?
User.find() in itself was not working with this gem. So, although it's now working, it concerns me a little as to why exactly.
If anyone could add anything here that'd be great.