Ahh. Thanks!

-----
Magically sent from my magical iPad

On May 6, 2010, at 16:06, Rhett Sutphin <[email protected]> wrote:

> Hi Amy,
> 
> On May 6, 2010, at 5:55 PM, Amy L wrote:
> 
>> After digging around: I think, yes, escaped ones should work but apparently 
>> weird things seem to happen with Rails---it turns out to not be a Haml 
>> issue. e.g. passing to a Rails app:
>> 
>>    
>> http://myhost.com/somecontroller/someaction?param1=key1&param2=key2&param3=key3
>> 
>> I get keys:
>> 
>>    param1=key1
>>    param2=key2
>>    param3=key3
>> 
>> Awesome. However
>> 
>>    
>> http://myhost.com/somecontroller/someaction?param1=key1&amp;param2=key2&amp;param3=key3
>> 
>> results in:
>> 
>>    amp=
>>    param1=key1
>>    param2=key2
>>    param3=key3
> 
> Putting escaped ampersands in, e.g., the URL you put in a browser's address 
> bar will give you this result.  However, if you have escaped ampersands in 
> URLs in, e.g., the form action attribute in your HTML, the browser will (or 
> should) take care of unescaping them.
> 
> Rhett
> 
>> 
>> And, back to the original problem I was having, I found the answer in the 
>> documentation....and it's not Haml either. It turns out that url_for() in 
>> ActionController::Base is different than url_for() in 
>> ActionView::Helpers::UrlHelper. The latter escapes ampersands. To make it 
>> *not* escape them you have to pass an additional param:
>> 
>>    :escape => false
>> 
>> (The example code I had posted was also erroneous. I was reading wrong 
>> output from some page source. Both the ERb and Haml views did generate the 
>> escaped &amp;.)
>> 
>> -- Amy
>> 
>> 
>> 
>> 
>> On Thu, May 6, 2010 at 3:29 PM, Nathan Weizenbaum <[email protected]> wrote:
>> Unescaped ampersands are never valid in HTML properties. Escaped ones should 
>> work just as well, and do conform to the spec.
>> On Thu, May 6, 2010 at 2:42 PM, Amy L <[email protected]> wrote:
>> Gah. The first example should have read:
>> 
>>    <a href="<%= url_for(:controller => 'somecontroller', :action => 
>> 'someaction', :foo => 'bar', :moo => 'cow') %>">Click me</a>
>> 
>> On Thu, May 6, 2010 at 2:41 PM, Amy L <[email protected]> wrote:
>> ... 
>> I'm using Rails 2.3.5. And when I write into an ERb template:
>> 
>>    <a href="url_for(:controller => 'somecontroller', :action => 
>> 'someaction', :foo => 'bar', :moo => 'cow')">Click me</a>
>> ...
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Haml" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/haml?hl=en.
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Haml" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/haml?hl=en.
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Haml" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/haml?hl=en.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Haml" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/haml?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to