I’m trying to replicate the following Rails method, but using JQuery:
Rails.cache.exist?("ped_basic")
Does anyone know how to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I am still experimenting with the optimal way to do this, but I’ve ended up using the ‘Gon’ gem to create a variable in my controller method (before_filter) that is able to be referenced by Rails as well as by jQuery.
In my controller method, I set my cache key equal to a gon.variable value, then can access the variable in jQuery via the same gon.variable name.
In other words:
The the variables can be accessed in my coffeescript code by simply referencing the same gon.variable name.