Forum: Ruby on Rails name and class href attribute in a link_to_remote

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
627e2ddff2a657a4dd5e4080e16a55b0?d=identicon&s=25 BB (Guest)
on 2006-05-09 21:36
I have a link to remote and I'm trying to get the name="" and the
class="" attribute in the href so the link will come out like this:

<a href="action" onclick"ajax(action)" name="Title Of Link"
class="someclass">

So far the link looks like this:

<% for course in @courses %>
<%= link_to_remote "#{course.title}",
	{:url => {:action => "add_to_cart", :id => course},
	 :complete =>  visual_effect(:highlight, "schedule", :duration =>
1.5)},
        {:href => url_for(:action => :add_to_cart, :id => course )} %>
<% end %>

Thanks.
2da252cc1d2fb3701126171831b50a65?d=identicon&s=25 Dave Coleman (pezdude)
on 2006-05-09 22:54
> <%= link_to_remote "#{course.title}",
> 	{:url => {:action => "add_to_cart", :id => course},
> 	 :complete =>  visual_effect(:highlight, "schedule", :duration =>
> 1.5)},
>         {:href => url_for(:action => :add_to_cart, :id => course )} %>


<%= link_to_remote "#{course.title}", {:url => {:action =>
"add_to_cart", :id => course}, :complete =>  visual_effect(:highlight,
"schedule", :duration =>
 1.5)}, :class => "someClass", :name => "Title Of Link"%>

?
7813d26c8ef483e08432ec9c574664d6?d=identicon&s=25 Ben (Guest)
on 2006-05-09 23:28
David C. wrote:

> <%= link_to_remote "#{course.title}", {:url => {:action =>
> "add_to_cart", :id => course}, :complete =>  visual_effect(:highlight,
> "schedule", :duration =>
>  1.5)}, :class => "someClass", :name => "Title Of Link"%>
>
> ?

Yeah, tried that, and it would normally work but the weird thing is with
the:

{:href => url_for(:action => :add_to_cart, :id => course" )}

part of the link everything gets screwed up.

Usually the class gets appended to the href like this
href="/action/?class="someClass" which does me no good.

no matter where I put the :class and :name when :href is present, I get
some sort of error
This topic is locked and can not be replied to.