On Dec 2, 2010, at 5:15 PM, MOLTEN wrote:

I'm doing it with Rails since I'd eventually like to gather and
display information such as how many movies were redirected and what
categories or whatever were the most popular.

Anyway, I've got it working with:

match "/:category/:movie" => redirect("http://netflix.com/search?
category=%{category}&movie=%{movie}")

The only problems so far are if a category or movie has a space in it,
then I get an error "bad URI(is not URI?):" since it tries to go to
the site with a space still in the URL.

How are these URLs getting to you at this point with spaces in them? Where are people clicking on URLs that contain spaces? That's where I would start with this.

How do I substitute spaces
inside symbols with something like a "+"? It has to be before it gets
redirected though. I'd like to be able to just type like netflixit.com/
dramatic comedy/heroes and it automatically turn the space into a "+"
right before it redirects, instead of manually typing the "+" in
netflixit.com/dramatic+comedy/heroes, which works correctly. So, I
guess before the URL a person types in gets to match
"/:category/:movie", it has to replace spaces with "+".

Are you doing this in your routes file? Or are you in a controller at this point? Do you have access to the url_for helper somehow? I suspect that could do this sort of escaping for you.

Or dig into that helper and see what it uses under the hood.

Walter

--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to