Answer the question
In order to leave comments, you need to log in
How to disable caching for a request in Rails?
Good day to all. I'm trying to sse, and trying to display data when the object is updated, but rails stubbornly takes the entry from the cache. How can this be prevented?
def index
response.headers['Content-Type'] = 'text/event-stream'
sse = SSE.new(response.stream)
begin
Test.on_change do |id|
test = Test.find(id)
t = render_to_string(partial: 'stats', formats: [:html], locals: {test: test}).gsub("\n","")
sse.write(t)
end
rescue IOError
# Client Disconnected
ensure
sse.close
end
render nothing: true
end
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question