I just read a good article on shared varaibles http://www.devarticl...uby-on-Rails/2/ Then I tried something that I thought should work, but does not... Here is my set up.
My controller has:
me = User.find_by(email: "email@example.com")
current_user = me
puts "Jay Test if @current_user is there.... " + @current_user.email
My sessions_helper contains:
logger.debug("Jay in current_user= Start")
@current_user = user #This sets the instance variable.
The error I receive after running a scenario where I click on a "following" button that invokes the following def in my controller as noted above is "no method available for nil object @current_user" (or something similar to this). I was certainly expecting @current_user to be a valid materialized object. Since it error-ed, I'm scratching my head and googling shared variables again... ugg Any ideas on why this is not working? Should it work and perhaps I have some other error?
My understanding is that @current_user will be an instance variable for the sessions_helper module. Actually perhaps since its a module and not a class will this cause the issue I'm seeing? Can a module have instance attributes, but not accessible to a controller?
thanks again in advance, Jay.