views:

17

answers:

1

It seems that we will need 2 methods, one is CGI.escape and the other might be h (unless we hardcode &.

Is there a method that takes an array or hash of params, and compose it into this form?

src="foo.php?href=http%3A%2F%2Fexample.com%2F&layout=standard"

It is for Rails 2.2.2, so if there is a method in Rails 2.x that can do it?

+1  A: 

I believe you can use Object#to_query to do it, but I'm not certain if it is available in Rails 2.x. For example:

{
  :href => "http://example.com/",
  :layout => "standard"
}.to_query # => "layout=standard&href=http%3A%2F%2Fexample.com%2F"
robbrit
動靜能量
Alright, so in your HTML put an h() around it, that should fix it.
robbrit