views:

37

answers:

2

I have the following:

commentable.id =3131

In the partial:

<%=f.text_area :content, :id=> 'comment_content_' commentable.id %>

I want it to make:

<textarea id="comment_content_3131" />

How do I combine the string with a variable in the partial? Thanks

A: 

['comment_content_', commentable.id]

WozPoz
i don't think this would work
Rishav Rastogi
it worked by added a space in between which is a fail
WozPoz
this works with AR conditions, not generally
Rishav Rastogi
+1  A: 

Just concatenate the two strings:

<%=f.text_area :content, :id=> ('comment_content_' + commentable.id.to_s) %>
sosborn
Thanks, worked great!
WozPoz