Passing data between blocks using sinatra
Posted
by Dan Galipo
on Stack Overflow
See other posts from Stack Overflow
or by Dan Galipo
Published on 2010-04-24T14:22:32Z
Indexed on
2010/04/24
14:23 UTC
Read the original article
Hit count: 171
Hi All
I'm trying to pass data between blocks using sinatra. For example:
@data = Hash.new
post "/" do
@data[:test] = params.fetch("test").to_s
redirect "/tmp"
end
get "/tmp" do
puts @data[:test]
end
However whenever i get to the tmp block @data is nil and throws an error. Why is that?
© Stack Overflow or respective owner