Ruby on Rails redirect_to not functioning in IF statement?
- by Hard-Boiled Wonderland
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!