On Apr 19, 10:14 am, Marika Ahonen <rails-mailing-l...@andreas-s.net>
wrote:
> Frederick Cheung wrote:
> > On Apr 18, 8:03 pm, Marika Ahonen <rails-mailing-l...@andreas-s.net>
> > wrote:
> >> >> 'text-decoration:none' %></td>
>
> >> > well assuming the link had id 23, the javascript you'd want to
> >> > generate would be $('link_long_23').toggle() - just build up that
> >> > string, using the usual string interpolation stuff for example
>
> >> > Fred
>
> >> Yes, but how can I pass link_long_id instead of giving the link_long_23?
> >> I can't get that working :(
>
> > Like I said, string interpolation:
>
> > greeting = "world"
> > puts "hello #{greeting}"
>
> > Fred
>
> Thank you Fred for your answer, but unfortunately that doesn't work. I
> get an error:
> 'undefined method `toggle' for "link_long_23":String'
> So it gets the id correctly, problem is the toggle? I'm quite new with
> all this, so I'm sorry if I ask stupid questions ;)

that sounds like you're still doing something like

link_to_function ,'blah', "$('something')".toggle

That's not what you want to do. you want to create the string  "$
('something').toggle" and pass that as the second argument to
link_to_function (that second argument should be a fragment of
javascript).

Fred
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to