 <p>If prop_row is a string, containing the name of an attribute, you ucan do this:</p> <pre><code>&lt;%= " active" if current_user.attributes[prop_row] == "repeat-x" %&gt; </code></pre> <p>Or use this:</p> <pre><code>&lt;%= " active" if current_user.send(prop_row.to_sym) == "repeat-x" %&gt; </code></pre>