ruby on rails - Why isn't my view variable interpolated inside brackets? -
i have code inside rails views/comments/_comments partial:
<%= render :partial => 'comments/#{@type}' %> also, passing @type variable through local get:
missing partial comments/#{@type} it works if replace following:
<%= render :partial => 'comments/post' %> so @type not evaluated inside views.
can explain that?
string interpolation in ruby works strings defined double quotation marks ("). should work:
<%= render :partial => "comments/#{@type}" %> or shorthand applicable if want interpolate value of instance variable:
<%= render :partial => "comments/#@type" %>
Comments
Post a Comment