Phlip
4/9/2009 2:43:00 PM
Taneal Bhandari wrote:
> I have the following link_to_remote statement that I need to convert
> into an <a href> tag, but can't figure it out. I looked at the
> rubyonrails api page and did a google search, but they don't have any
> examples similar to mine where I can figure it out. Here's my
> statement:
>
> <%= link_to_remote tag.name,
> :url => {:action => "tag_selector", :id => @order.id},
> :html => {:id => tag.id, :class => "tag"},
> :with => "'tag=" + tag.id.to_s + "'"%>
I need help understanding the question. (But please consider the Ruby-on-Rails
Talk forum at news://news.gmane.org:119/gmane.comp.lang.ruby.rails in future!)
Link_to_remote translates into an a with an href of # and an onclick of a ton of
JavaScript. The code you wrote is already converted. Try this:
<%=
x = link_to_remote tag.name,
:url => {:action => "tag_selector", :id => @order.id},
:html => {:id => tag.id, :class => "tag"},
:with => "'tag=" + tag.id.to_s + "'"
puts x
x
%>
When your page renders (or when - ahem - your functional tests run), you should
see your link_to_remote statement converted into an <a href> tag.
What will you do with it now?