Becky Franklin wrote:> Sorry if this is a daft question but it''s driving me insane. I
have:
>
> :on_click_item => "treeOnClickItem(this, item.id, item.isLeaf,
item.code
> )"
>
> as an option for a tree (implemented by the live-tree plugin) but I need
> the item.code to be a find statement to a model. Within that statement
> is there a way to call to the model/db?
I''m not familiar with the live-tree plugin, so this is a bit of a shot
in the dark, but that string looks like Javascript code that''s being
written out to the browser somewhere.
So if this is the find statement:
@my_code = Bakery.find(:conditions => "bagels IS NULL").code
(or whatever) then try sticking that result into the code using
standard string interpolation:
:on_click_item => "treeOnClickItem(this, item.id, item.isLeaf,
#{@my_code})"
Chris
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---