Ruby on Rails redirect_to not functioning in IF statement?
Posted
by
Hard-Boiled Wonderland
on Stack Overflow
See other posts from Stack Overflow
or by Hard-Boiled Wonderland
Published on 2011-01-03T01:24:40Z
Indexed on
2011/01/03
1:53 UTC
Read the original article
Hit count: 508
Hi,
I am redirecting a POST request to ensure the URL is correct along with other things. The redirect worked fine before I added in the if statements for town below:
if !params[:address].blank?
town = Town.find(:all, :conditions => ["name = ?", params[:address]])
@towns = town
if !town.blank?
redirect_to '/town/' + params[:address]
else
@town_invalid = 'test'
end
end
end
I am sure it is something simple and that I simply cannot see it. Also if you see any glaring errors or code mishaps let me know as I am just starting out.
EDIT: I should mention this is what I get back from Safari when a real town is entered:
Safari can’t open the page.Safari can’t open the page “http://localhost:3000/” because the server unexpectedly dropped the connection. This sometimes occurs when the server is busy. Wait for a few minutes, and then try again.
Thanks!
© Stack Overflow or respective owner