Forum: Ruby Building Strings

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.
Will M. (Guest)
on 2006-04-20 01:16
I need to build the DOM id for my RJS template using an id passed to the
template.  How do I add the value of an id paramater to get the DOM id I
need.  For example given this call in my RJS template:

page.replace_html "list", :partial => "show_new_list"

I want "list" to be "list" + the id I pass in.

Thanks.
Austin Z. (Guest)
on 2006-04-20 01:28
(Received via mailing list)
On 4/19/06, Will M. <removed_email_address@domain.invalid> wrote:
> I need to build the DOM id for my RJS template using an id passed to the
> template.  How do I add the value of an id paramater to get the DOM id I
> need.  For example given this call in my RJS template:
>
> page.replace_html "list", :partial => "show_new_list"
>
> I want "list" to be "list" + the id I pass in.

You're *probably* going to get a better answer on the rails list
http://lists.rubyonrails.org/mailman/listinfo/rails than here, but you
could do:

page.replace_html "list#{id}", :partial => "show_new_list"

Maybe.

-austin
Will M. (Guest)
on 2006-04-20 02:05
Austin Z. wrote:
> On 4/19/06, Will M. <removed_email_address@domain.invalid> wrote:
>> I need to build the DOM id for my RJS template using an id passed to the
>> template.  How do I add the value of an id paramater to get the DOM id I
>> need.  For example given this call in my RJS template:
>>
>> page.replace_html "list", :partial => "show_new_list"
>>
>> I want "list" to be "list" + the id I pass in.
>
> You're *probably* going to get a better answer on the rails list
> http://lists.rubyonrails.org/mailman/listinfo/rails than here, but you
> could do:
>
> page.replace_html "list#{id}", :partial => "show_new_list"
>
> Maybe.
>
> -austin


That worked thanks!  I need to get a good Ruby primer.  I'm a java
developer trying our RoR and I really like the framework but I am
limited by my lack of experience with the Ruby syntax.
Josh K. (Guest)
on 2006-04-20 02:23
(Received via mailing list)
On 4/19/06, Will M. <removed_email_address@domain.invalid> wrote:

> That worked thanks!  I need to get a good Ruby primer.  I'm a java
> developer trying our RoR and I really like the framework but I am
> limited by my lack of experience with the Ruby syntax.



http://www.manning.com/black/
This topic is locked and can not be replied to.