Reputation: 992
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
Upvotes: 0
Views: 286
Reputation: 390
As you would substitute any other string. :)
<%= f.text_area :content, :id=> "comment_content_#{commentable.id}" %>
Upvotes: 0
Reputation: 14694
Just concatenate the two strings:
<%=f.text_area :content, :id=> ('comment_content_' + commentable.id.to_s) %>
Upvotes: 2