I want to wait a few seconds on the erb answerdoorno before it redirects to police how do i do that having problems finding the answer....
post '/answerdoor' do
answerdoor = params[:door]
door = rand(2).floor
if answerdoor.include?('yes') && door == 0
erb :answerdoor, :locals => {:answerdoor => "You Decide to get up and answer the door", :answerdoor2 => " You are in Luck It's Your good buddy Dave." }
elsif answerdoor.include?('yes') && door == 1
erb :answerdoor, :locals => {:answerdoor => "You Decide to get up and answer the door", :answerdoor2 => " Oh No its The cops." }
redirect to ('/police')
elsif answerdoor.include?('no') && door == 0
erb :answerdoorno, :locals => {:answerdoor => "You Decide not to answer the door, but it dosen't Really matter cause Dave walks in anyways."}
elsif answerdoor.include?('no') && door == 1
erb :answerdoorno, :locals => {:answerdoor => "You Decide not to answer the door, but it dosen't Really matter cause its the cops and the bust in."}
redirct to ('/police')
end
end
Have you tried using the sleep method before the erb render?
You can't do what you want in Ruby. You should render your HTML where you could add some javascript or html to redirect after a second or more.
For example add this meta tag
<meta http-equiv="refresh" content="1; url=http://example.com/" />
Where 1
is an amount of seconds
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.