Forum: Ruby on Rails Easy Newb Question

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.
Brian D. (Guest)
on 2006-02-18 23:23
OK, so I have a link_to_remote.  I am too dumb to figure out where I can
set a css class or id attribute.

<%= link_to_remote("X", :url => { :action => :destroy, :id => message },
:confirm => "Delete '" + message.title + "'?",
:complete => "item_removed('item_" + message.id.to_s + "')") %>

Can somebody help?  It seems like it should be obvious, but the
documentation doesn't show any examples that I could find.
Rad Smith (Guest)
on 2006-02-18 23:48
Brian D. wrote:
> OK, so I have a link_to_remote.  I am too dumb to figure out where I can
> set a css class or id attribute.
>
> <%= link_to_remote("X", :url => { :action => :destroy, :id => message },
> :confirm => "Delete '" + message.title + "'?",
> :complete => "item_removed('item_" + message.id.to_s + "')") %>
>
> Can somebody help?  It seems like it should be obvious, but the
> documentation doesn't show any examples that I could find.

Try this:

<%= link_to_remote("X", { :url => { :action => :destroy, :id => message
}, :confirm => "Delete '" + message.title + "'?", :complete =>
"item_removed('item_" + message.id.to_s + "')" }, { :style => "color:
red;" }) %>

Whew, that's a doozy.
Brian D. (Guest)
on 2006-02-18 23:57
> <%= link_to_remote("X", { :url => { :action => :destroy, :id => message
> }, :confirm => "Delete '" + message.title + "'?", :complete =>
> "item_removed('item_" + message.id.to_s + "')" }, { :style => "color:
> red;" }) %>

That did it!  Thanks.  Now I get the whole
link_to_remote(name, options = {}, html_options = {})
syntax.  Was struggling with that a bit.
Luke R. (Guest)
on 2006-02-19 04:01
(Received via mailing list)
If you are ever in doubt, try explicitly containing each options hash in
a {
}
This topic is locked and can not be replied to.