Building Strings

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.

On 4/19/06, Will M. [email protected] 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

Austin Z. wrote:

On 4/19/06, Will M. [email protected] 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.

On 4/19/06, Will M. [email protected] 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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs