Building Strings


#1

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.


#2

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


#3

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.


#4

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/